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
53 lines
1.8 KiB
YAML
53 lines
1.8 KiB
YAML
---
|
|
- name: Check if Timeshift is installed
|
|
ansible.builtin.command: timeshift --version
|
|
register: timeshift_check
|
|
failed_when: false
|
|
changed_when: false
|
|
|
|
- name: Install Timeshift
|
|
ansible.builtin.apt:
|
|
name: timeshift
|
|
state: present
|
|
become: true
|
|
when:
|
|
- timeshift_install | default(true) | bool
|
|
- timeshift_check.rc != 0
|
|
|
|
- name: Create Timeshift snapshot directory
|
|
ansible.builtin.file:
|
|
path: "{{ timeshift_snapshot_location }}"
|
|
state: directory
|
|
mode: '0755'
|
|
become: true
|
|
when: timeshift_install | default(true) | bool
|
|
|
|
- name: Create snapshot before playbook execution
|
|
ansible.builtin.command: >
|
|
timeshift --create
|
|
--comments "{{ timeshift_snapshot_description }}"
|
|
--tags {{ timeshift_snapshot_tags | join(',') }}
|
|
--scripted
|
|
become: true
|
|
register: timeshift_snapshot_result
|
|
when:
|
|
- timeshift_auto_snapshot | default(true) | bool
|
|
- timeshift_check.rc == 0 or timeshift_install | default(true) | bool
|
|
changed_when: "'Snapshot created successfully' in timeshift_snapshot_result.stdout or 'Created snapshot' in timeshift_snapshot_result.stdout"
|
|
failed_when: >
|
|
timeshift_snapshot_result.rc != 0
|
|
and "'already exists' not in timeshift_snapshot_result.stderr | default('')"
|
|
and "'Snapshot created' not in timeshift_snapshot_result.stderr | default('')"
|
|
ignore_errors: true
|
|
|
|
- name: Display snapshot information
|
|
ansible.builtin.debug:
|
|
msg:
|
|
- "Timeshift snapshot operation completed"
|
|
- "Output: {{ timeshift_snapshot_result.stdout | default('Check with: sudo timeshift --list') }}"
|
|
- "To list snapshots: sudo timeshift --list"
|
|
- "To restore: sudo timeshift --restore --snapshot 'SNAPSHOT_NAME'"
|
|
when:
|
|
- timeshift_auto_snapshot | default(true) | bool
|
|
- timeshift_snapshot_result is defined
|