diff --git a/tasks/teardown/drain-and-remove-nodes.yml b/tasks/teardown/drain-and-remove-nodes.yml index 874c00e..e480852 100644 --- a/tasks/teardown/drain-and-remove-nodes.yml +++ b/tasks/teardown/drain-and-remove-nodes.yml @@ -24,7 +24,7 @@ cmd: >- {{ k3s_install_dir }}/kubectl drain {{ item }} --ignore-daemonsets - --delete-local-data + --{{ k3s_drain_command[ansible_version.string is version_compare('1.22', '>=')] }} --force delegate_to: "{{ k3s_control_delegate }}" run_once: true diff --git a/vars/main.yml b/vars/main.yml index 26e2836..bae0040 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -159,3 +159,8 @@ k3s_cgroup_subsys: documentation: | If you are running Alpine Linux, see: https://rancher.com/docs/k3s/latest/en/advanced/#additional-preparation-for-alpine-linux-setup + +# Drain command +k3s_drain_command: + true: delete-emptydir-data + false: delete-local-data