c12s-kubespray/roles/container-engine/docker/tasks/reset.yml
cyril-corbon 672e47a7eb
feat: check & uninstall container engine (#8439)
Signed-off-by: Cyril Corbon <corboncyril@gmail.com>
2022-02-28 10:59:46 -08:00

61 lines
1.4 KiB
YAML

---
- name: Docker | ensure docker-ce repository is removed
apt_repository:
repo: "{{ item }}"
state: absent
with_items: "{{ docker_repo_info.repos }}"
when: ansible_pkg_mgr == 'apt'
tags:
- reset_docker
- name: Docker | Remove docker repository on Fedora
file:
name: "{{ yum_repo_dir }}/docker.repo"
state: absent
when: ansible_distribution == "Fedora" and not is_ostree
tags:
- reset_docker
- name: Docker | Remove docker repository on RedHat/CentOS/Oracle/AlmaLinux Linux
template:
name: "{{ yum_repo_dir }}/docker-ce.repo"
state: absent
when:
- ansible_os_family == "RedHat"
- ansible_distribution != "Fedora"
- not is_ostree
tags:
- reset_docker
- name: Docker | Stop docker service
service:
name: docker
daemon_reload: true
enabled: false
masked: true
state: stopped
tags:
- reset_docker
- name: Docker | Remove docker configuration files
file:
name: "{{ item }}"
state: absent
loop:
- /etc/systemd/system/docker.service.d/
- /var/lib/docker
- /etc/docker
tags:
- reset_docker
- name: Docker | Remove docker package
package:
name: "{{ docker_package_info.pkgs }}"
state: absent
changed_when: false
when:
- not ansible_os_family in ["Flatcar", "Flatcar Container Linux by Kinvolk"]
- not is_ostree
- docker_package_info.pkgs|length > 0
tags:
- reset_docker