From d526e9fdfaa60293f594234991a28cefa0a073f6 Mon Sep 17 00:00:00 2001 From: Stefan Bethke Date: Thu, 31 Oct 2024 11:27:12 +0100 Subject: [PATCH] Add cron job to prune old images --- playbooks/roles/docker_compose/tasks/main.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/playbooks/roles/docker_compose/tasks/main.yaml b/playbooks/roles/docker_compose/tasks/main.yaml index e8cfcd0..8e211c1 100644 --- a/playbooks/roles/docker_compose/tasks/main.yaml +++ b/playbooks/roles/docker_compose/tasks/main.yaml @@ -111,3 +111,11 @@ minute: "0" hour: "5" job: "cd /ansible_docker_compose; docker compose pull && docker compose up -d" + +- name: Install automatic cleanup cron job + become: true + ansible.builtin.cron: + name: 'docker compose auto update' + minute: "23" + hour: "4" + job: "docker system prune -a -f"