diff --git a/roles/docker/defaults/main.yaml b/roles/docker/defaults/main.yaml index 01f7836..a61d425 100644 --- a/roles/docker/defaults/main.yaml +++ b/roles/docker/defaults/main.yaml @@ -2,3 +2,4 @@ docker_app_name: some-app docker_dir: /mnt/data/{{ docker_app_name }} docker_build: policy +docker_remove_orphans: true diff --git a/roles/docker/handlers/main.yaml b/roles/docker/handlers/main.yaml index 29e557f..2ea8b6c 100644 --- a/roles/docker/handlers/main.yaml +++ b/roles/docker/handlers/main.yaml @@ -1,12 +1,13 @@ --- - name: Stop service + listen: Restart service community.docker.docker_compose_v2: project_src: "{{ docker_dir }}" state: stopped - listen: Restart service - name: Start service + listen: Restart service community.docker.docker_compose_v2: project_src: "{{ docker_dir }}" state: present build: "{{ docker_build }}" - listen: Restart service + remove_orphans: "{{ docker_remove_orphans }}" diff --git a/roles/docker/tasks/main.yaml b/roles/docker/tasks/main.yaml index bb1937b..301b4f8 100644 --- a/roles/docker/tasks/main.yaml +++ b/roles/docker/tasks/main.yaml @@ -30,3 +30,4 @@ community.docker.docker_compose_v2: project_src: "{{ docker_dir }}" state: present + remove_orphans: "{{ docker_remove_orphans }}"