ansible_role_restic/tasks/main.yml

39 lines
1.3 KiB
YAML

---
- name: Add OS specific variables
ansible.builtin.include_vars: "{{ lookup('first_found', restic_os_variables) }}"
- name: Perform optional versionscheck
ansible.builtin.include_tasks: 'versioncheck.yml'
when: submodules_versioncheck | bool
- name: Make sure restic is available
ansible.builtin.include_tasks: 'preparation.yml'
- name: Make sure restic is installed
ansible.builtin.include_tasks: 'install.yml'
when: not restic_executable.stat.exists or not restic_installed.stat.exists
- name: Initialize restic repo(s)
ansible.builtin.include_tasks: 'configure.yml'
- name: Create backup script
ansible.builtin.include_tasks: 'backup.yml'
loop_control:
loop_var: loop_distribution
vars:
distribution: '{{ ansible_distribution }}'
distribution_version: '{{ ansible_distribution_version }}'
distribution_major_version: '{{ ansible_distribution_major_version }}'
- name: Schedule restic backup
ansible.builtin.include_tasks: 'schedule.yml'
loop_control:
loop_var: loop_distribution
vars:
distribution: '{{ ansible_distribution }}'
distribution_version: '{{ ansible_distribution_version }}'
distribution_major_version: '{{ ansible_distribution_major_version }}'
- name: Run backups now
ansible.builtin.include_tasks: 'run_backup.yml'
when: restic_backup_now | bool