31 lines
847 B
YAML
31 lines
847 B
YAML
|
- name: Include variables files & run borg-init role
|
||
|
hosts: localhost
|
||
|
roles:
|
||
|
- include-vars
|
||
|
- borg-init
|
||
|
|
||
|
- name: Backup project(s)
|
||
|
hosts: localhost
|
||
|
vars:
|
||
|
run_backup: true
|
||
|
vars_prompt:
|
||
|
- name: selected_projects
|
||
|
prompt: "Choose projects to backup (leave empty to backup all. Projects list: {{ hostvars['localhost']['projects_to_backup'] }})"
|
||
|
private: false
|
||
|
unsafe: true
|
||
|
|
||
|
tasks:
|
||
|
- name: Backup project(s)
|
||
|
include_role:
|
||
|
name: "{{ project }}"
|
||
|
loop: "{{ (selected_projects | split) | default(projects_to_backup, true) }}"
|
||
|
loop_control:
|
||
|
# Do not use default variable name 'item' to prevent collisions with loops in roles.
|
||
|
loop_var: project
|
||
|
when: project in projects_to_backup
|
||
|
|
||
|
- name: Compact borg repository
|
||
|
hosts: localhost
|
||
|
roles:
|
||
|
- borg-compact
|