Extracted from the environment repository, wave 1. Scrubbed of private references: namespace mortis, no repository paths or issue numbers in comments and docs, the removed docker_ufw_rules guard dropped, the molecule scenario uses the FQCN and no provisioner environment overrides. ansible-lint mocks the role's FQCN because CI checks the Collection out outside an ansible_collections path. Verified: the commit hooks. Not verified: the molecule scenario (CI only). Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
40 lines
1.0 KiB
YAML
40 lines
1.0 KiB
YAML
---
|
|
# Run with docker_remove=true (and docker_remove_data=true to purge) on a host that is safe to change.
|
|
- name: Stop and disable Docker service
|
|
become: true
|
|
ansible.builtin.systemd:
|
|
name: "{{ docker_service }}"
|
|
state: stopped
|
|
enabled: false
|
|
tags: [docker, remove]
|
|
|
|
- name: Remove Docker Engine packages
|
|
become: true
|
|
ansible.builtin.apt:
|
|
name: "{{ docker_packages }}"
|
|
state: absent
|
|
purge: "{{ docker_remove_data | default(false) | bool }}"
|
|
tags: [docker, remove]
|
|
|
|
- name: Remove Docker APT source list
|
|
become: true
|
|
ansible.builtin.file:
|
|
path: "{{ docker_apt_list_path }}"
|
|
state: absent
|
|
tags: [docker, remove]
|
|
|
|
- name: Remove Docker APT keyring
|
|
become: true
|
|
ansible.builtin.file:
|
|
path: "{{ docker_keyring_path }}"
|
|
state: absent
|
|
tags: [docker, remove]
|
|
|
|
- name: Remove Docker data directory (images, containers, volumes)
|
|
become: true
|
|
ansible.builtin.file:
|
|
path: /var/lib/docker
|
|
state: absent
|
|
when: docker_remove_data | default(false) | bool
|
|
tags: [docker, remove]
|