51 lines
1.5 KiB
YAML
51 lines
1.5 KiB
YAML
---
|
|
# =============================================================================
|
|
# 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 }}
|
|
|
|
Backups at:
|
|
{{ gitea_backup_dir }}
|
|
|
|
To restart:
|
|
ansible-playbook -i inventory.yml playbook.yml --ask-vault-pass
|
|
|
|
To fully remove:
|
|
ansible-playbook -i inventory.yml cleanup-full.yml
|
|
|
|
============================================
|