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
|
2020-02-26 21:05:38 +01:00
|
|
|
ignore_errors: true
|
|
|
|
changed_when: false
|
|
|
|
register: check_k3s_process
|
|
|
|
|
|
|
|
- name: Fail if k3s is still running
|
2020-12-12 15:27:59 +01:00
|
|
|
ansible.builtin.fail:
|
2020-02-26 21:05:38 +01:00
|
|
|
msg: k3s is still running, uninstall script failed. Please investigate.
|
|
|
|
when: check_k3s_process.rc == 0
|
|
|
|
|
|
|
|
- name: Check that docker is not running
|
2020-12-21 20:14:52 +01:00
|
|
|
ansible.builtin.command: pgrep docker
|
2020-02-26 21:05:38 +01:00
|
|
|
ignore_errors: true
|
|
|
|
changed_when: false
|
|
|
|
register: check_k3s_docker_process
|
2020-10-22 20:26:15 +02:00
|
|
|
when: ("docker" in k3s_runtime_config and k3s_runtime_config.docker)
|
2020-02-26 21:05:38 +01:00
|
|
|
|
|
|
|
- name: Fail if docker is still running
|
2020-12-12 15:27:59 +01:00
|
|
|
ansible.builtin.fail:
|
2020-02-26 21:05:38 +01:00
|
|
|
msg: docker is still running, uninstall script failed. Please investigate.
|
2020-10-22 20:26:15 +02:00
|
|
|
when: ("docker" in k3s_runtime_config and 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:
|
2020-02-26 21:05:38 +01:00
|
|
|
msg: k3s-killall.sh is still running, uninstall script failed. Please investigate.
|
|
|
|
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:
|
2020-02-26 21:05:38 +01:00
|
|
|
msg: k3s-uninstall.sh is still running, uninstall script failed. Please investigate.
|
|
|
|
when: check_k3s_uninstall.stat.exists
|