ansible/roles/timeshift/README.md
ilia 01d35172e4
Some checks failed
CI / lint-and-test (pull_request) Failing after 58s
CI / ansible-validation (pull_request) Failing after 1m58s
CI / secret-scanning (pull_request) Successful in 58s
CI / dependency-scan (pull_request) Successful in 1m1s
CI / sast-scan (pull_request) Successful in 1m55s
CI / license-check (pull_request) Successful in 58s
CI / vault-check (pull_request) Failing after 1m55s
CI / playbook-test (pull_request) Successful in 1m57s
CI / container-scan (pull_request) Successful in 1m27s
CI / sonar-analysis (pull_request) Successful in 2m4s
CI / workflow-summary (pull_request) Successful in 55s
Fix: Resolve linting errors and improve firewall configuration
- 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
2025-12-17 22:51:04 -05:00

101 lines
2.5 KiB
Markdown

# 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 execution
- `timeshift_snapshot_description` (default: `"Ansible playbook snapshot"`) - Description for snapshots
- `timeshift_snapshot_tags` (default: `["ansible", "pre-playbook"]`) - Tags for snapshots
- `timeshift_snapshot_type` (default: `"RSYNC"`) - Snapshot type: RSYNC or BTRFS
### Retention
- `timeshift_keep_daily` (default: `7`) - Keep daily snapshots for N days
- `timeshift_keep_weekly` (default: `4`) - Keep weekly snapshots for N weeks
- `timeshift_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:
```yaml
roles:
- { role: timeshift, tags: ['timeshift', 'snapshot'] }
```
### Disable Auto-Snapshot
```yaml
roles:
- { role: timeshift, tags: ['timeshift'] }
```
In host_vars or group_vars:
```yaml
timeshift_auto_snapshot: false
```
### Manual Snapshot
```bash
# On the target host
sudo timeshift --create --comments "Manual snapshot before changes"
```
### Rollback
```bash
# 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:
```yaml
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 `/home` by default (configurable)