From 6b00bf557c8fbf89d1afeb28664d88f846798bba Mon Sep 17 00:00:00 2001 From: Nathaniel Landau Date: Tue, 9 Jan 2024 08:51:58 -0500 Subject: [PATCH] feat: purge dangling Docker containers on job sync --- ansible.cfg | 2 +- tasks/orchestration_jobs.yml | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ansible.cfg b/ansible.cfg index d1e74ac..7b8b053 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -1,7 +1,7 @@ [defaults] nocows = True roles_path = ./galaxy-roles:./roles -collections_paths = ./ +collections_path = ./ inventory = ./inventory.yml stdout_callback = yaml any_errors_fatal = True diff --git a/tasks/orchestration_jobs.yml b/tasks/orchestration_jobs.yml index 7bee6ee..8db7244 100644 --- a/tasks/orchestration_jobs.yml +++ b/tasks/orchestration_jobs.yml @@ -74,3 +74,15 @@ dest: "{{ docker_compose_file_location }}/{{ item | basename | regex_replace('.j2$', '') }}" mode: 0644 with_fileglob: "../templates/docker_compose_files/*.j2" + +- name: "Prune docker caches" + community.docker.docker_prune: + containers: true + images: true + images_filters: + dangling: false + networks: true + volumes: true + builder_cache: true + when: + - is_docker_compose_client or is_nomad_client or is_nomad_server