38 lines
829 B
YAML
38 lines
829 B
YAML
---
|
|
- name: Leave Docker Swarm (if member)
|
|
ansible.builtin.shell: docker swarm leave --force || true
|
|
ignore_errors: true
|
|
|
|
- name: Stop Docker service
|
|
ansible.builtin.systemd_service:
|
|
name: docker
|
|
state: stopped
|
|
enabled: true
|
|
|
|
- name: Remove Docker data directories
|
|
ansible.builtin.file:
|
|
path: "{{ item }}"
|
|
state: absent
|
|
loop:
|
|
- /var/lib/docker
|
|
- /var/lib/docker/volumes
|
|
- /var/lib/docker/swarm
|
|
- /var/lib/docker/network
|
|
- /etc/docker/key.json
|
|
- /run/docker
|
|
ignore_errors: true
|
|
|
|
- name: Remove dnf packages
|
|
ansible.builtin.dnf:
|
|
name:
|
|
- docker
|
|
- docker-client
|
|
- docker-client-latest
|
|
- docker-common
|
|
- docker-latest
|
|
- docker-latest-logrotate
|
|
- docker-logrotate
|
|
- docker-engine
|
|
- podman
|
|
- runc
|
|
state: absent |