Ansible Code Backup
This role backs up the entire Ansible repository (playbooks, roles, configurations) to dual NAS storage for redundancy.
Overview
This role backs up the entire Ansible repository (playbooks, roles, configurations) to dual NAS storage for redundancy. It creates timestamped compressed archives and automatically manages retention by keeping only the last 5 backups per NAS.
What This Role Does
- Ensures backup directories exist on both NAS mount points
- Creates compressed tar.gz archive of the entire Ansible repository
- Copies archive to both NAS devices with timestamp in filename
- Finds all existing backups on each NAS
- Removes old backups, keeping only the 5 most recent per NAS
Role Variables
| Variable | Description |
|---|---|
ansible_code_backup_syno_mount_point | Synology NAS backup destination |
ansible_code_backup_prxmxomv_mount_point | Proxmox OMV NAS backup destination |
ansible_code_backup_source_path | Directory to archive |
ansible_code_backup_nases_path | List of timestamped destination file paths |
Notes
- NAS must be mounted before running — the playbook handles this via
nas_mount - Keeps last 5 backups per NAS; older files are automatically deleted
- Archiving is idempotent in structure but creates a new file each run