mirror of
https://github.com/roles-ansible/ansible_role_restic/
synced 2024-12-13 13:20:18 +01:00
Merge pull request #17 from roles-ansible/handlers
restart restic timer if something changed
This commit is contained in:
commit
a82f54c0f2
4 changed files with 18 additions and 2 deletions
13
handlers/main.yml
Normal file
13
handlers/main.yml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
---
|
||||||
|
- name: systemctl restart restic.timer
|
||||||
|
become: true
|
||||||
|
ansible.builtin.systemd:
|
||||||
|
name: "restic-{{ item.name | replace(' ', '') | string }}.timer"
|
||||||
|
state: 'restarted'
|
||||||
|
daemon_reload: true
|
||||||
|
with_items: '{{ restic_backups }}'
|
||||||
|
when:
|
||||||
|
- restic_create_cron
|
||||||
|
- item.name is defined
|
||||||
|
- item.scheduled | default(false)
|
||||||
|
- ansible_service_mgr == 'systemd'
|
|
@ -11,6 +11,7 @@
|
||||||
mode: '0644'
|
mode: '0644'
|
||||||
no_log: true
|
no_log: true
|
||||||
with_items: '{{ restic_backups }}'
|
with_items: '{{ restic_backups }}'
|
||||||
|
notify: systemctl restart restic.timer
|
||||||
when:
|
when:
|
||||||
- restic_create_cron
|
- restic_create_cron
|
||||||
- item.name is defined
|
- item.name is defined
|
||||||
|
@ -53,6 +54,7 @@
|
||||||
enabled: true
|
enabled: true
|
||||||
daemon_reload: true
|
daemon_reload: true
|
||||||
with_items: '{{ restic_backups }}'
|
with_items: '{{ restic_backups }}'
|
||||||
|
notify: systemctl restart restic.timer
|
||||||
when:
|
when:
|
||||||
- restic_create_cron
|
- restic_create_cron
|
||||||
- item.name is defined
|
- item.name is defined
|
||||||
|
@ -66,6 +68,7 @@
|
||||||
state: started
|
state: started
|
||||||
daemon_reload: true
|
daemon_reload: true
|
||||||
with_items: '{{ restic_backups }}'
|
with_items: '{{ restic_backups }}'
|
||||||
|
notify: systemctl restart restic.timer
|
||||||
when:
|
when:
|
||||||
- restic_create_cron
|
- restic_create_cron
|
||||||
- item.name is defined
|
- item.name is defined
|
||||||
|
|
|
@ -4,7 +4,7 @@ Description=Run restic backup {{ item.name }} every night
|
||||||
[Timer]
|
[Timer]
|
||||||
OnCalendar={{ restic_systemd_timer_default_OnCalendar }}
|
OnCalendar={{ restic_systemd_timer_default_OnCalendar }}
|
||||||
RandomizedDelaySec={{ restic_systemd_timer_randomizeddelaysec }}
|
RandomizedDelaySec={{ restic_systemd_timer_randomizeddelaysec }}
|
||||||
Persistent=yes
|
Persistent=true
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=timers.target
|
WantedBy=timers.target
|
||||||
|
|
|
@ -10,5 +10,5 @@ restic_os_variables:
|
||||||
paths:
|
paths:
|
||||||
- 'vars'
|
- 'vars'
|
||||||
|
|
||||||
playbook_version_number: 11 # should be int
|
playbook_version_number: 12 # should be int
|
||||||
playbook_version_path: 'do1jlr.restic.version'
|
playbook_version_path: 'do1jlr.restic.version'
|
||||||
|
|
Loading…
Reference in a new issue