feat: add monthly Docker prune cron Ansible playbook (#29) #45
No reviewers
Labels
No Label
ai-changes-requested
ai-failed
ai-pr-opened
ai-reviewed
ai-reviewing
ai-working
infra-audit
monitoring
operations
proxmox
script
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/claude-home#45
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "issue/29-docker-image-prune-cron-on-all-docker-hosts"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #29
Summary
Adds
ansible/playbooks/docker-prune.yml— an Ansible playbook that deploys/etc/cron.monthly/docker-pruneto all six Docker hosts in the homelab.Hosts covered
docker-homediscord-botsdatabases-botsdocker-sbadocker-home-serversmanticore(ubuntu-manticore)Script deployed to each host
Safety notes
docker image prune -aonly removes images not referenced by any container (running or stopped) — theuntil=720hfilter adds a 30-day age gate on top of thatdocker volume pruneskips volumes with akeeplabel — mark critical volumes withdocker volume update <vol> --label keep=trueto exempt themhosts: <group>:... / become: truepattern asmask-avahi.ymlRun instructions
Files changed
ansible/playbooks/docker-prune.yml(new)AI Code Review
Files Reviewed
ansible/playbooks/docker-prune.yml(added) — the intended change for issue #29ansible/playbooks/monthly-reboot.yml(in diff, already in main via PR #26)ansible/playbooks/post-reboot-startup.yml(in diff, already in main via PR #26)ansible/systemd/ansible-monthly-reboot.service(in diff, already in main via PR #26)ansible/systemd/ansible-monthly-reboot.timer(in diff, already in main via PR #26)ansible/systemd/ansible-post-reboot.service(in diff, already in main via PR #26)server-configs/proxmox/maintenance-reboot.md(in diff, already in main via PR #26)Findings
Correctness
docker-prune.ymlcorrectly deploys/etc/cron.monthly/docker-pruneto all six Docker hosts usingansible.builtin.copywith explicitowner,group, andmode: "0755".set -euo pipefail— correct defensive shell practice.docker volume prunecorrectly omits the unsupporteduntilfilter (onlylabel!=keepapplied). Theuntil=720hfilter on container/image prune is correctly supported and applied.label!=keepsemantics are correct: volumes without akeeplabel are pruned; labeled volumes are spared.test -x …) withchanged_when: falseis correct in intent, though redundant since the copy task enforcesmode: "0755". Harmless.mask-avahi.ymlplaybook structure (hosts: <group>:..., become: true, FQCN modules).Security
become: trueis required — cron.monthly writes need root. No privilege escalation concern beyond what's expected.docker image prune -aonly removes images not referenced by any container (running or stopped) — theuntil=720hfilter prevents removing recently-pulled images.docker volume prunewithlabel!=keepis the intended safety mechanism. Note:docker volume updateto add labels requires Docker 26+; on older engines, labels must be set at volume creation time. This is a documentation concern in the PR body only — not in the deployed script.Style & Conventions
ansible.builtin.copy,ansible.builtin.command) — consistent with existing playbooks.mask-avahi.ymlstyle: usage examples, undo instructions, host list.Suggestions
64f299a(before PR #26 merged the monthly-reboot automation into main). As a result, the diff shows 6 monthly-reboot files that already exist in main with identical content. Gitea confirmsmergeable: true— the 3-way merge will succeed without duplicating content.docker-prune.ymlis the only net-new file. Consider rebasing issue branches on main before opening PRs to keep diffs focused.Verdict: APPROVED
docker-prune.ymlis correct, follows project conventions, and is safe to deploy. The 6 extra files in the diff are pre-existing in main with identical content and will merge cleanly — no action required.Automated review by Claude PR Reviewer
Checkout
From your project repository, check out a new branch and test the changes.