kubectl commands on node must use short name (#220)

Co-authored-by: Igor Tretyak <itretyak@ptsecurity.com>
This commit is contained in:
fragpit 2024-01-26 23:09:58 +03:00 committed by GitHub
parent cfd9400edf
commit 0c0d3bb38d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -26,7 +26,7 @@
- name: Ensure uninstalled nodes are drained # noqa no-changed-when - name: Ensure uninstalled nodes are drained # noqa no-changed-when
ansible.builtin.command: ansible.builtin.command:
cmd: >- cmd: >-
{{ k3s_install_dir }}/kubectl drain {{ item }} {{ k3s_install_dir }}/kubectl drain {{ hostvars[item].ansible_hostname }}
--ignore-daemonsets --ignore-daemonsets
--{{ k3s_drain_command[ansible_version.string is version_compare('1.22', '>=')] }} --{{ k3s_drain_command[ansible_version.string is version_compare('1.22', '>=')] }}
--force --force
@ -42,7 +42,7 @@
- name: Ensure uninstalled nodes are removed # noqa no-changed-when - name: Ensure uninstalled nodes are removed # noqa no-changed-when
ansible.builtin.command: 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 }}" delegate_to: "{{ k3s_control_delegate }}"
run_once: true run_once: true
when: when: