Skip to content

Commit 2de4c47

Browse files
authored
chore: Add a simple playbook to bring down the site (#266)
### Summary This is required, for example, if a DB upgrade is necessary. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Added comprehensive automated infrastructure management system for containerised application services across all deployment servers. Enables streamlined and efficient operational procedures for managing service lifecycles, including proper shutdown and resource cleanup capabilities. Supports enhanced system maintenance processes, improved operational consistency, and overall deployment reliability across the entire production infrastructure environment. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 5b720d9 commit 2de4c47

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

infra/ansible/site_down.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
- name: Bring down all containers
3+
hosts: all
4+
tasks:
5+
- name: Stop all running Docker containers
6+
ansible.builtin.shell: |
7+
running_containers=$(docker ps -q)
8+
if [ -n "$running_containers" ]; then
9+
docker stop $running_containers
10+
fi
11+
register: stop_containers_result
12+
changed_when: stop_containers_result.stdout != ""
13+
14+
- name: Remove all stopped Docker containers
15+
ansible.builtin.command: docker container prune -f
16+
register: prune_containers_result
17+
changed_when: "'Deleted Containers:' in prune_containers_result.stdout"

0 commit comments

Comments
 (0)