Switch to terraform
This commit is contained in:
47
ansible/gitea/cleanup-soft.yml
Normal file
47
ansible/gitea/cleanup-soft.yml
Normal file
@@ -0,0 +1,47 @@
|
||||
---
|
||||
# =============================================================================
|
||||
# Gitea - Soft Cleanup
|
||||
# =============================================================================
|
||||
# Stops containers but preserves configuration and data
|
||||
#
|
||||
# Usage:
|
||||
# ansible-playbook -i inventory.yml cleanup-soft.yml
|
||||
# =============================================================================
|
||||
|
||||
- name: Gitea - Soft Cleanup
|
||||
hosts: gitea_servers
|
||||
become: true
|
||||
vars_files:
|
||||
- group_vars/gitea_servers.yml
|
||||
|
||||
tasks:
|
||||
- name: Check if docker-compose.yml exists
|
||||
ansible.builtin.stat:
|
||||
path: "{{ gitea_base_dir }}/docker-compose.yml"
|
||||
register: compose_file
|
||||
|
||||
- name: Stop containers (preserve data)
|
||||
ansible.builtin.command:
|
||||
cmd: docker compose down
|
||||
chdir: "{{ gitea_base_dir }}"
|
||||
when: compose_file.stat.exists
|
||||
ignore_errors: true
|
||||
changed_when: true
|
||||
|
||||
- name: Display cleanup status
|
||||
ansible.builtin.debug:
|
||||
msg: |
|
||||
============================================
|
||||
Gitea - Soft Cleanup Complete
|
||||
============================================
|
||||
|
||||
Containers stopped. Data preserved at:
|
||||
{{ gitea_data_dir }}
|
||||
|
||||
To restart:
|
||||
ansible-playbook -i inventory.yml playbook.yml --ask-vault-pass
|
||||
|
||||
To fully remove:
|
||||
ansible-playbook -i inventory.yml cleanup-full.yml
|
||||
|
||||
============================================
|
||||
Reference in New Issue
Block a user