Skip to content

Commit

Permalink
kubectl command on node must use short name
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor Tretyak committed Jan 10, 2024
1 parent 6b25876 commit b9cce2f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tasks/ensure_drain_and_remove_nodes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
- name: Ensure uninstalled nodes are drained # noqa no-changed-when
ansible.builtin.command:
cmd: >-
{{ k3s_install_dir }}/kubectl drain {{ item }}
{{ k3s_install_dir }}/kubectl drain {{ hostvars[item].ansible_hostname }}
--ignore-daemonsets
--{{ k3s_drain_command[ansible_version.string is version_compare('1.22', '>=')] }}
--force
Expand All @@ -42,7 +42,7 @@

- name: Ensure uninstalled nodes are removed # noqa no-changed-when
ansible.builtin.command:
cmd: "{{ k3s_install_dir }}/kubectl delete node {{ item }}"
cmd: "{{ k3s_install_dir }}/kubectl delete node {{ hostvars[item].ansible_hostname }}"
delegate_to: "{{ k3s_control_delegate }}"
run_once: true
when:
Expand Down

0 comments on commit b9cce2f

Please sign in to comment.