diff --git a/remove-node.yml b/remove-node.yml index e39432f02..0fae1a994 100644 --- a/remove-node.yml +++ b/remove-node.yml @@ -5,7 +5,7 @@ ansible_ssh_pipelining: true gather_facts: true -- hosts: etcd:k8s-cluster:vault:calico-rr +- hosts: "{{ node | default('etcd:k8s-cluster:vault:calico-rr') }}" vars_prompt: name: "delete_nodes_confirmation" prompt: "Are you sure you want to delete nodes state? Type 'yes' to delete nodes." @@ -22,7 +22,7 @@ roles: - { role: remove-node/pre-remove, tags: pre-remove } -- hosts: kube-node +- hosts: "{{ node | default('kube-node') }}" roles: - { role: kubespray-defaults } - { role: reset, tags: reset } diff --git a/roles/remove-node/post-remove/tasks/main.yml b/roles/remove-node/post-remove/tasks/main.yml index 30c75d1b4..8017e85e2 100644 --- a/roles/remove-node/post-remove/tasks/main.yml +++ b/roles/remove-node/post-remove/tasks/main.yml @@ -3,7 +3,7 @@ - name: Delete node command: kubectl delete node {{ item }} with_items: - - "{{ groups['kube-node'] }}" + - "{{ node.split(',') | default(groups['kube-node']) }}" delegate_to: "{{ groups['kube-master']|first }}" run_once: true ignore_errors: yes diff --git a/roles/remove-node/pre-remove/tasks/main.yml b/roles/remove-node/pre-remove/tasks/main.yml index 836309bbf..5db5fa13a 100644 --- a/roles/remove-node/pre-remove/tasks/main.yml +++ b/roles/remove-node/pre-remove/tasks/main.yml @@ -9,7 +9,7 @@ --timeout {{ drain_timeout }} --delete-local-data {{ item }} with_items: - - "{{ groups['kube-node'] }}" + - "{{ node.split(',') | default(groups['kube-node']) }}" failed_when: false delegate_to: "{{ groups['kube-master']|first }}" run_once: true