report backup status using apprise
This commit is contained in:
parent
50f2d0ada1
commit
15e8d14327
5 changed files with 40 additions and 17 deletions
|
@ -42,6 +42,13 @@
|
|||
cmd: ifup -a
|
||||
when: interfaces.changed
|
||||
|
||||
- name: Delete externally managed environment file
|
||||
shell:
|
||||
cmd: "rm /usr/lib/python*/EXTERNALLY-MANAGED"
|
||||
register: rm
|
||||
changed_when: "rm.rc == 0"
|
||||
failed_when: "false"
|
||||
|
||||
roles:
|
||||
- {role: ssh_ca_known_hosts, tags: ssh_ca_known_hosts}
|
||||
- {role: deploy_ssh_certificates, tags: deploy_ssh_certificates}
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
location:
|
||||
source_directories:
|
||||
- /data
|
||||
repositories:
|
||||
- 'ssh://root@lewis.hyp/mnt/kingston1TB/hosts/{{ ansible_hostname }}'
|
||||
retention:
|
||||
keep_daily: 7
|
||||
keep_weekly: 4
|
||||
keep_monthly: 6
|
||||
storage:
|
||||
unknown_unencrypted_repo_access_is_ok: true
|
||||
hooks:
|
||||
before_everything:
|
||||
- /root/stop_vms.sh
|
||||
after_everything:
|
||||
- /root/start_vms.sh
|
|
@ -4,9 +4,13 @@
|
|||
- borgbackup
|
||||
- borgmatic
|
||||
|
||||
- name: Install apprise
|
||||
pip:
|
||||
name: apprise
|
||||
|
||||
- name: Copy Borgmatic script
|
||||
template:
|
||||
src: "{{ role_path }}/files/backup.yml"
|
||||
src: "{{ role_path }}/templates/backup.yml.j2"
|
||||
dest: /root/backup.yml
|
||||
|
||||
- name: Copy start_vms.sh
|
||||
|
|
27
ansible/roles/borg/templates/backup.yml.j2
Normal file
27
ansible/roles/borg/templates/backup.yml.j2
Normal file
|
@ -0,0 +1,27 @@
|
|||
# vi: ft=yaml
|
||||
location:
|
||||
source_directories:
|
||||
- /data
|
||||
repositories:
|
||||
- 'ssh://root@lewis.hyp/mnt/kingston1TB/hosts/{{ ansible_hostname }}'
|
||||
retention:
|
||||
keep_daily: 7
|
||||
keep_weekly: 4
|
||||
keep_monthly: 6
|
||||
storage:
|
||||
unknown_unencrypted_repo_access_is_ok: true
|
||||
hooks:
|
||||
before_everything:
|
||||
- 'apprise --body="{{ ansible_hostname }}: Stopping VMs" {{ apprise_url }} || true'
|
||||
- /root/stop_vms.sh
|
||||
- 'apprise --body="{{ ansible_hostname }}: Stopped VMs" {{ apprise_url }} || true'
|
||||
after_everything:
|
||||
- 'apprise --body="{{ ansible_hostname }}: Starting VMs" {{ apprise_url }} || true'
|
||||
- /root/start_vms.sh
|
||||
- 'apprise --body="{{ ansible_hostname }}: Started VMs" {{ apprise_url }} || true'
|
||||
before_backup:
|
||||
- 'apprise --body="{{ ansible_hostname }}: Performing backup" {{ apprise_url }} || true'
|
||||
after_backup:
|
||||
- 'apprise --body="{{ ansible_hostname }}: Backup done" {{ apprise_url }} || true'
|
||||
on_error:
|
||||
- 'apprise --body="{{ ansible_hostname }}: Backup error" {{ apprise_url }} || true'
|
1
ansible/roles/borg/vars/main.yml
Normal file
1
ansible/roles/borg/vars/main.yml
Normal file
|
@ -0,0 +1 @@
|
|||
apprise_url: 'apprises://apprise.pim.kunis.nl:444/backups'
|
Reference in a new issue