476b225fca
This looks wrong, in hindsight I'm not really sure how it works. Ansible 6 seems to barf on it. Make this one evaluated statement. Change-Id: I7f73bf723af1086fc4473e76614ce30ca14f3d74
67 lines
1.5 KiB
YAML
67 lines
1.5 KiB
YAML
- name: Create backup directory
|
|
file:
|
|
state: directory
|
|
path: /opt/backups
|
|
|
|
- name: Install borg
|
|
include_role:
|
|
name: install-borg
|
|
|
|
- name: Install prune script
|
|
copy:
|
|
src: 'prune-borg-backups.sh'
|
|
dest: '/usr/local/bin/prune-borg-backups'
|
|
owner: root
|
|
group: root
|
|
mode: '0755'
|
|
|
|
- name: Install backup volume monitor
|
|
copy:
|
|
src: 'backup-volume-monitor.sh'
|
|
dest: '/usr/local/bin/backup-volume-monitor'
|
|
owner: root
|
|
group: root
|
|
mode: '0755'
|
|
|
|
- name: Run backup volume monitor
|
|
cron:
|
|
name: backup-volume-monitor
|
|
state: present
|
|
job: '/usr/local/bin/backup-volume-monitor'
|
|
minute: '0'
|
|
hour: '0'
|
|
|
|
- name: Install backup verification
|
|
copy:
|
|
src: 'verify-borg-backups.sh'
|
|
dest: '/usr/local/bin/verify-borg-backups'
|
|
owner: root
|
|
group: root
|
|
mode: '0755'
|
|
|
|
- name: Run backup verification
|
|
cron:
|
|
name: verify-borg-backups
|
|
state: present
|
|
job: '/usr/local/bin/verify-borg-backups >> /var/log/verify-borg-backups.log 2>&1'
|
|
minute: '0'
|
|
hour: '0'
|
|
weekday: '0'
|
|
|
|
- name: Rotate verification logs
|
|
include_role:
|
|
name: logrotate
|
|
vars:
|
|
logrotate_file_name: '/var/log/verify-borg-backups.log'
|
|
|
|
- name: Build all borg users from backup hosts
|
|
set_fact:
|
|
borg_users: '{{ borg_users + [hostvars[item]["borg_user"]] }}'
|
|
with_inventory_hostnames: 'borg-backup:!disabled'
|
|
|
|
- name: Create borg users
|
|
include_tasks: user.yaml
|
|
loop: '{{ borg_users }}'
|
|
loop_control:
|
|
loop_var: borg_user
|