Add clean playbook
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
- name: Clean OCI Stack
|
||||
hosts: Docker
|
||||
tasks:
|
||||
|
||||
- name: Stop containers using Docker Compose
|
||||
ansible.builtin.command:
|
||||
cmd: docker compose down
|
||||
chdir: ~/OCI_Build/docker
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Pause for 30 seconds to allow containers to stabilize
|
||||
ansible.builtin.pause:
|
||||
seconds: 30
|
||||
|
||||
- name: Check container status
|
||||
ansible.builtin.shell: docker compose ps -q | xargs -n1 docker container inspect --format '{{ "{{" }} .State.Running {{ "}}" }}'
|
||||
args:
|
||||
chdir: ~/OCI_Build/docker
|
||||
register: container_status
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Remove build folder
|
||||
ansible.builtin.command:
|
||||
cmd: rm -rf OCI_Build/
|
||||
Reference in New Issue
Block a user