mirror of
https://github.com/roles-ansible/ansible_role_restic/
synced 2024-11-09 13:23:30 +01:00
restart restic timer if something changed
This commit is contained in:
parent
c961e1b281
commit
1870c78534
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'
|
||||
no_log: true
|
||||
with_items: '{{ restic_backups }}'
|
||||
notify: systemctl restart restic.timer
|
||||
when:
|
||||
- restic_create_cron
|
||||
- item.name is defined
|
||||
|
@ -53,6 +54,7 @@
|
|||
enabled: true
|
||||
daemon_reload: true
|
||||
with_items: '{{ restic_backups }}'
|
||||
notify: systemctl restart restic.timer
|
||||
when:
|
||||
- restic_create_cron
|
||||
- item.name is defined
|
||||
|
@ -66,6 +68,7 @@
|
|||
state: started
|
||||
daemon_reload: true
|
||||
with_items: '{{ restic_backups }}'
|
||||
notify: systemctl restart restic.timer
|
||||
when:
|
||||
- restic_create_cron
|
||||
- item.name is defined
|
||||
|
|
|
@ -4,7 +4,7 @@ Description=Run restic backup {{ item.name }} every night
|
|||
[Timer]
|
||||
OnCalendar={{ restic_systemd_timer_default_OnCalendar }}
|
||||
RandomizedDelaySec={{ restic_systemd_timer_randomizeddelaysec }}
|
||||
Persistent=yes
|
||||
Persistent=true
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
|
|
|
@ -10,5 +10,5 @@ restic_os_variables:
|
|||
paths:
|
||||
- 'vars'
|
||||
|
||||
playbook_version_number: 11 # should be int
|
||||
playbook_version_number: 12 # should be int
|
||||
playbook_version_path: 'do1jlr.restic.version'
|
||||
|
|
Loading…
Reference in a new issue