- name: Ensure uninstalled nodes are drained
ansible.builtin.command:
cmd: >-
{{ k3s_install_dir }}/kubectl drain {{ item }}
--ignore-daemonsets
--delete-local-data
--force
delegate_to: "{{ k3s_control_delegate }}"
run_once: true
when:
- kubectl_get_nodes_result.stdout is defined
- item in kubectl_get_nodes_result.stdout
- hostvars[item].k3s_state is defined
- hostvars[item].k3s_state == 'uninstalled'
loop: "{{ ansible_play_hosts }}"
become: "{{ k3s_become_for_kubectl | ternary(true, false, k3s_become_for_all) }}"
Expected Result
ubuntu@master01 clean and clear of previously installed k3s aka master | SUCCESS.
Actual Result
ubuntu@master01 still has k3s installed and running since drain tasks failed and ansible exited with an error:
Flag --delete-local-data has been deprecated
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Summary
Playbook failed to cleanly uninstall v1.22.2+k3s1.
Flag
--delete-local-data
has been deprecated, This option is deprecated and will be deleted. Use--delete-emptydir-data.
.Issue Type
Controller Environment and Configuration
ansible-role-k3s version:
v2.11.0
Steps to Reproduce
Install latest k3s (>=v1.22.2+k3s1) and then try to uninstall it using ansible-role-k3s.
Part of config that hits deprecation notice: drain-and-remove-nodes.yml.
Expected Result
ubuntu@master01
clean and clear of previously installed k3s akamaster | SUCCESS
.Actual Result
ubuntu@master01
still has k3s installed and running since drain tasks failed and ansible exited with an error:Flag --delete-local-data has been deprecated
Proposed Update
drain-and-remove-nodes.yml.