Files
FabledSteward/steward/ansible/bundled/maintenance/docker_prune.yml
T
bvandeusen e5f6a11f94
CI / lint (push) Successful in 3s
CI / unit (push) Successful in 8s
CI / integration (push) Successful in 2m15s
CI / publish (push) Successful in 52s
feat(ansible): playbooks self-describe via "# description:" comment
Playbooks can ship a human description Steward reads and shows when one is
selected. Convention: a `# description: <text>` magic comment (Ansible rejects
unknown play keys, so a comment is the portable place — works for third-party
playbooks too); falls back to the first play's name:. sources
.discover_playbook_description().

Surfaced at the top of the shared _playbook_vars.html partial, which loads on
playbook selection in the host run form, schedules form, and browse run form.
All four bundled playbooks (provision/install/update/docker_prune) now carry a
description line. Unit tests added.

Scribe #900.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 11:25:25 -04:00

28 lines
1.1 KiB
YAML

---
# description: Reclaim disk on Docker / Swarm nodes by pruning unused images, containers, networks and build cache.
# Reclaim disk on Docker / Docker Swarm nodes by removing unused data.
# Safe by default: prunes dangling images, stopped containers, unused networks
# and build cache. Set extra-vars to widen scope:
# prune_all_images=true also remove ALL unused images (not just dangling)
# prune_volumes=true also remove unused named volumes (data loss risk)
- name: Docker system prune
hosts: all
gather_facts: false
become: true
vars:
prune_all_images: false
prune_volumes: false
tasks:
- name: Run docker system prune
ansible.builtin.command:
argv: >-
{{ ['docker', 'system', 'prune', '-f']
+ (['-a'] if prune_all_images | bool else [])
+ (['--volumes'] if prune_volumes | bool else []) }}
register: prune_result
changed_when: "'Total reclaimed space: 0B' not in prune_result.stdout"
- name: Report reclaimed space
ansible.builtin.debug:
msg: "{{ prune_result.stdout_lines | select | list }}"