Add prunedocker.yml

This commit is contained in:
2025-07-20 19:00:54 +02:00
parent 9612aa0dc8
commit 0d61cd8702

33
prunedocker.yml Normal file
View File

@@ -0,0 +1,33 @@
##Prune just images
---
- name: Prune unused Docker images
hosts: all
become: yes
tasks:
- name: Prune dangling images
docker_image:
prune: yes
dangling: yes
- name: Prune all unused images
command: docker image prune -a -f
args:
warn: false
##Prune images and everything else - be careful with this one
---
- name: Prune unused Docker images & everything else
hosts: all
become: yes
tasks:
- name: Prune dangling images
community.docker.docker_prune:
images: yes
dangling: yes
- name: Prune all unused Docker objects (system prune)
ansible.builtin.shell: docker system prune -a -f
args:
warn: false