Files
Kamino/roles/docker/tasks/remove.yml
T
Dragonish 567e9cca7c
Build / build (pull_request) Successful in 27s
Lint / lint (pull_request) Successful in 2m15s
Molecule / molecule (pull_request) Successful in 4m17s
feat(docker): add opt-in boot and shutdown units for hosts that run Docker with live-restore
docker_start_missed installs a boot unit that starts the containers dockerd's
restore pass skipped after a reboot of the whole host. docker_stop_at_shutdown
installs a unit that ends container processes at shutdown while the network and
NFS shares are still up, so a container holding an NFS mount no longer stalls
the shutdown. Both default to false and do nothing without /usr/bin/docker.

Refs #369

Assisted-by: Claude Code
2026-11-25 17:31:37 +00:00

54 lines
1.5 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: Take out the start-at-boot unit
ansible.builtin.include_tasks: unit_absent.yml
vars:
__docker_unit_name: docker-start-missed
__docker_unit_script: /usr/local/sbin/docker-start-missed
tags: [docker, remove]
- name: Take out the stop-at-shutdown unit
ansible.builtin.include_tasks: unit_absent.yml
vars:
__docker_unit_name: docker-stop-at-shutdown
__docker_unit_script: /usr/local/sbin/docker-stop-at-shutdown
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]