1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_restic.git synced 2024-12-11 23:41:32 +01:00

Review changes and fix some issues

This commit is contained in:
L3D 2021-08-02 14:13:30 +02:00
parent e0f3f5c87c
commit d238ef67d2
Signed by: l3d
GPG key ID: CD08445BFF4313D1
3 changed files with 24 additions and 8 deletions

View file

@ -5,6 +5,7 @@
name: "restic-{{ item.name | replace(' ', '') | string }}.timer" name: "restic-{{ item.name | replace(' ', '') | string }}.timer"
state: 'restarted' state: 'restarted'
daemon_reload: true daemon_reload: true
masked: false
with_items: '{{ restic_backups }}' with_items: '{{ restic_backups }}'
when: when:
- restic_create_schedule - restic_create_schedule

View file

@ -50,6 +50,7 @@
name: "restic-{{ item.name | replace(' ', '') | string }}.service" name: "restic-{{ item.name | replace(' ', '') | string }}.service"
enabled: true enabled: true
daemon_reload: true daemon_reload: true
masked: false
with_items: '{{ restic_backups }}' with_items: '{{ restic_backups }}'
notify: systemctl restart restic.timer notify: systemctl restart restic.timer
when: when:
@ -63,6 +64,7 @@
enabled: true enabled: true
state: started state: started
daemon_reload: true daemon_reload: true
masked: false
with_items: '{{ restic_backups }}' with_items: '{{ restic_backups }}'
notify: systemctl restart restic.timer notify: systemctl restart restic.timer
when: when:
@ -110,20 +112,33 @@
no_log: true no_log: true
with_items: '{{ restic_backups }}' with_items: '{{ restic_backups }}'
when: when:
- restic_create_schedule - restic_create_schedule | bool
- item.name is defined - item.name is defined
- item.scheduled | default(false) - item.scheduled | default(false)
- ansible_service_mgr != 'systemd' or restic_force_cron | default(false) - ansible_service_mgr != 'systemd' or restic_force_cron | default(false) or restic_schedule_type == "cronjob"
- restic_schedule_type == "cronjob" or restic_force_cron | default(false)
- name: make sure no unwanted systemd timer is available - name: make sure no unwanted systemd timer is available
ansible.builtin.systemd: ansible.builtin.systemd:
name: "restic-{{ item.name | replace(' ', '') | string }}.timer" name: "restic-{{ item.name | replace(' ', '') | string }}.timer"
state: stopped state: 'stopped'
enabled: false enabled: false
masked: true
with_items: '{{ restic_backups }}'
when: when:
- restic_create_schedule - restic_create_schedule | bool
- item.name is defined - item.name is defined
- item.scheduled | default(false) - item.scheduled | default(false)
- ansible_service_mgr != 'systemd' or restic_force_cron | default(false) - ansible_service_mgr != 'systemd' or restic_force_cron | default(false) or restic_schedule_type == "cronjob"
- restic_schedule_type == "cronjob" or restic_force_cron | default(false)
- name: mask systemd service
ansible.builtin.systemd:
name: "restic-{{ item.name | replace(' ', '') | string }}.service"
state: 'stopped'
enabled: false
masked: true
with_items: '{{ restic_backups }}'
when:
- restic_create_schedule | bool
- item.name is defined
- item.scheduled | default(false)
- ansible_service_mgr != 'systemd' or restic_force_cron | default(false) or restic_schedule_type == "cronjob"

View file

@ -10,5 +10,5 @@ restic_os_variables:
paths: paths:
- 'vars' - 'vars'
playbook_version_number: 13 # should be int playbook_version_number: 14 # should be int
playbook_version_path: 'do1jlr.restic.version' playbook_version_path: 'do1jlr.restic.version'