Add clean playbook

This commit is contained in:
madereddy
2023-12-11 14:48:07 -05:00
parent 3cd21c1801
commit 122f03b687
2 changed files with 25 additions and 1 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ services:
container_name: uptime
restart: unless-stopped
ports:
- "3031:3031"
- "3001:3001"
volumes:
- ./uptime:/app/data
caddy:
+24
View File
@@ -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/