2020-02-26 21:05:38 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: Check that k3s is not running
|
2020-12-21 20:14:52 +01:00
|
|
|
ansible.builtin.command: pgrep k3s
|
2021-02-28 17:45:38 +01:00
|
|
|
failed_when:
|
|
|
|
- check_k3s_process.rc == 0
|
|
|
|
- not ansible_check_mode
|
2020-02-26 21:05:38 +01:00
|
|
|
changed_when: false
|
|
|
|
register: check_k3s_process
|
|
|
|
|
|
|
|
- name: Check that docker is not running
|
2020-12-21 20:14:52 +01:00
|
|
|
ansible.builtin.command: pgrep docker
|
2021-02-28 17:45:38 +01:00
|
|
|
failed_when:
|
|
|
|
- check_k3s_docker_process.rc == 0
|
|
|
|
- not ansible_check_mode
|
2020-02-26 21:05:38 +01:00
|
|
|
changed_when: false
|
|
|
|
register: check_k3s_docker_process
|
2021-02-16 16:46:01 +01:00
|
|
|
when:
|
|
|
|
- k3s_runtime_config.docker is defined
|
|
|
|
- k3s_runtime_config.docker
|
2020-02-26 21:05:38 +01:00
|
|
|
|
|
|
|
- name: Fail if k3s binaries have not been removed
|
2020-12-12 15:27:59 +01:00
|
|
|
ansible.builtin.stat:
|
2020-02-26 21:05:38 +01:00
|
|
|
path: "{{ k3s_install_dir }}/{{ item }}"
|
|
|
|
register: check_k3s_binaries_removed
|
|
|
|
failed_when: check_k3s_binaries_removed.stat.exists
|
|
|
|
loop:
|
|
|
|
- k3s
|
|
|
|
- kubectl
|
|
|
|
- crictl
|
|
|
|
- ctr
|
|
|
|
|
|
|
|
- name: Check k3s-killall.sh is removed
|
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
|
|
|
|
|
|
|
|
- name: Fail if k3s-killall.sh script still exists
|
2020-12-12 15:27:59 +01:00
|
|
|
ansible.builtin.fail:
|
2021-02-16 16:46:01 +01:00
|
|
|
msg: k3s-killall.sh still exists, uninstall script failed. Please investigate.
|
2020-02-26 21:05:38 +01:00
|
|
|
when: check_k3s_killall.stat.exists
|
|
|
|
|
|
|
|
- name: Check k3s-uninstall.sh is removed
|
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
|
|
|
|
|
|
|
|
- name: Fail if k3s-uninstall.sh script still exists
|
2020-12-12 15:27:59 +01:00
|
|
|
ansible.builtin.fail:
|
2021-02-16 16:46:01 +01:00
|
|
|
msg: k3s-uninstall.sh is still exists, uninstall script failed. Please investigate.
|
2020-02-26 21:05:38 +01:00
|
|
|
when: check_k3s_uninstall.stat.exists
|