2020-02-25 18:29:39 +01:00
|
|
|
---
|
|
|
|
|
2020-02-26 21:05:38 +01:00
|
|
|
- name: Check to see if k3s-killall.sh exits
|
2020-12-12 15:27:59 +01:00
|
|
|
ansible.builtin.stat:
|
2020-02-26 21:05:38 +01:00
|
|
|
path: /usr/local/bin/k3s-killall.sh
|
|
|
|
register: check_k3s_killall_script
|
|
|
|
|
|
|
|
- name: Check to see if k3s-uninstall.sh exits
|
2020-12-12 15:27:59 +01:00
|
|
|
ansible.builtin.stat:
|
2020-02-26 21:05:38 +01:00
|
|
|
path: /usr/local/bin/k3s-uninstall.sh
|
|
|
|
register: check_k3s_uninstall_script
|
|
|
|
|
|
|
|
- name: Run k3s-killall.sh
|
2021-04-10 13:15:51 +02:00
|
|
|
ansible.builtin.command:
|
|
|
|
cmd: /usr/local/bin/k3s-killall.sh
|
2020-02-25 21:41:29 +01:00
|
|
|
register: k3s_killall
|
|
|
|
changed_when: k3s_killall.rc == 0
|
2020-02-26 21:05:38 +01:00
|
|
|
when: check_k3s_killall_script.stat.exists
|
2022-01-02 22:52:09 +01:00
|
|
|
become: "{{ k3s_become }}"
|
2020-02-25 18:29:39 +01:00
|
|
|
|
2020-02-26 21:05:38 +01:00
|
|
|
- name: Run k3s-uninstall.sh
|
2021-04-10 13:15:51 +02:00
|
|
|
ansible.builtin.command:
|
|
|
|
cmd: /usr/local/bin/k3s-uninstall.sh
|
2020-02-26 21:05:38 +01:00
|
|
|
args:
|
2020-02-25 18:29:39 +01:00
|
|
|
removes: /usr/local/bin/k3s-uninstall.sh
|
2020-02-25 21:41:29 +01:00
|
|
|
register: k3s_uninstall
|
|
|
|
changed_when: k3s_uninstall.rc == 0
|
2020-02-26 21:05:38 +01:00
|
|
|
when: check_k3s_uninstall_script.stat.exists
|
2022-01-02 22:52:09 +01:00
|
|
|
become: "{{ k3s_become }}"
|
2020-02-25 18:29:39 +01:00
|
|
|
|
2021-01-30 18:23:31 +01:00
|
|
|
- name: Ensure hard links are removed
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: "{{ k3s_install_dir }}/{{ item }}"
|
|
|
|
state: absent
|
|
|
|
loop:
|
|
|
|
- kubectl
|
|
|
|
- crictl
|
|
|
|
- ctr
|
2021-02-16 16:46:01 +01:00
|
|
|
when:
|
|
|
|
- k3s_install_hard_links
|
|
|
|
- not ansible_check_mode
|
2022-01-02 22:52:09 +01:00
|
|
|
become: "{{ k3s_become }}"
|