Some checks failed
CI / lint-and-test (push) Successful in 1m16s
CI / ansible-validation (push) Successful in 5m49s
CI / secret-scanning (push) Successful in 1m33s
CI / dependency-scan (push) Successful in 2m48s
CI / sast-scan (push) Successful in 5m46s
CI / license-check (push) Successful in 1m11s
CI / vault-check (push) Failing after 5m25s
CI / playbook-test (push) Successful in 5m32s
CI / container-scan (push) Successful in 4m32s
CI / sonar-analysis (push) Successful in 6m53s
CI / workflow-summary (push) Successful in 1m6s
- Fix UFW firewall to allow outbound traffic (was blocking all outbound) - Add HOST parameter support to shell Makefile target - Fix all ansible-lint errors (trailing spaces, missing newlines, document starts) - Add changed_when: false to check commands - Fix variable naming (vault_devGPU -> vault_devgpu) - Update .ansible-lint config to exclude .gitea/ and allow strategy: free - Fix NodeSource repository GPG key handling in shell playbook - Add missing document starts to host_vars files - Clean up empty lines in datascience role files Reviewed-on: #2
2.5 KiB
2.5 KiB
Timeshift Role
Manages Timeshift system snapshots for backup and rollback capabilities.
Purpose
This role installs and configures Timeshift, a system restore utility for Linux. It can automatically create snapshots before playbook execution to enable easy rollback if something goes wrong.
Features
- Installs Timeshift package
- Creates automatic snapshots before playbook runs
- Configurable snapshot retention
- Easy rollback capability
Variables
Installation
timeshift_install(default:true) - Install Timeshift package
Snapshot Settings
timeshift_auto_snapshot(default:true) - Automatically create snapshot before playbook executiontimeshift_snapshot_description(default:"Ansible playbook snapshot") - Description for snapshotstimeshift_snapshot_tags(default:["ansible", "pre-playbook"]) - Tags for snapshotstimeshift_snapshot_type(default:"RSYNC") - Snapshot type: RSYNC or BTRFS
Retention
timeshift_keep_daily(default:7) - Keep daily snapshots for N daystimeshift_keep_weekly(default:4) - Keep weekly snapshots for N weekstimeshift_keep_monthly(default:6) - Keep monthly snapshots for N months
Location
timeshift_snapshot_location(default:"/timeshift") - Where to store snapshots
Usage
Basic Usage
Add to your playbook:
roles:
- { role: timeshift, tags: ['timeshift', 'snapshot'] }
Disable Auto-Snapshot
roles:
- { role: timeshift, tags: ['timeshift'] }
In host_vars or group_vars:
timeshift_auto_snapshot: false
Manual Snapshot
# On the target host
sudo timeshift --create --comments "Manual snapshot before changes"
Rollback
# List snapshots
sudo timeshift --list
# Restore from snapshot
sudo timeshift --restore --snapshot 'YYYY-MM-DD_HH-MM-SS'
# Or use the Makefile target
make timeshift-restore HOST=dev02 SNAPSHOT=2025-12-17_21-30-00
Integration with Playbooks
The role is designed to be run early in playbooks to create snapshots before making changes:
roles:
- { role: timeshift, tags: ['timeshift', 'snapshot'] } # Create snapshot first
- { role: base }
- { role: development }
# ... other roles
Dependencies
- Debian/Ubuntu-based system
- Root/sudo access
Notes
- Snapshots require significant disk space
- RSYNC snapshots are larger but work on any filesystem
- BTRFS snapshots are smaller but require BTRFS filesystem
- Snapshots exclude
/homeby default (configurable)