Add cleanup logic
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Danny Bessems 2021-07-14 15:29:25 +02:00
parent c3ab086a5c
commit c339ca0fd2

View File

@ -1,3 +1,20 @@
- name: Get current running containers
community.docker.docker_host_info:
containers: yes
register: docker_info
- name: Stop/Remove all current containers
communit.docker.docker_container:
name: "{{ item }}"
state: absent
loop: "{{ docker_info.containers | map(attribute='Id') | list }}"
- name: Prune everything
community.docker.docker_prune:
containers: yes
images: yes
volumes: yes
- name: Create Docker volumes - name: Create Docker volumes
community.docker.docker_volume: community.docker.docker_volume:
name: "{{ item.name }}" name: "{{ item.name }}"