From d238ef67d2ae47d12b2a43c7938ac598b2af01d1 Mon Sep 17 00:00:00 2001 From: L3D Date: Mon, 2 Aug 2021 14:13:30 +0200 Subject: [PATCH] Review changes and fix some issues --- handlers/main.yml | 1 + tasks/schedule.yml | 29 ++++++++++++++++++++++------- vars/main.yml | 2 +- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/handlers/main.yml b/handlers/main.yml index 874c2b6..46817b5 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -5,6 +5,7 @@ name: "restic-{{ item.name | replace(' ', '') | string }}.timer" state: 'restarted' daemon_reload: true + masked: false with_items: '{{ restic_backups }}' when: - restic_create_schedule diff --git a/tasks/schedule.yml b/tasks/schedule.yml index 9b47da4..551ca3c 100644 --- a/tasks/schedule.yml +++ b/tasks/schedule.yml @@ -50,6 +50,7 @@ name: "restic-{{ item.name | replace(' ', '') | string }}.service" enabled: true daemon_reload: true + masked: false with_items: '{{ restic_backups }}' notify: systemctl restart restic.timer when: @@ -63,6 +64,7 @@ enabled: true state: started daemon_reload: true + masked: false with_items: '{{ restic_backups }}' notify: systemctl restart restic.timer when: @@ -110,20 +112,33 @@ no_log: true with_items: '{{ restic_backups }}' when: - - restic_create_schedule + - restic_create_schedule | bool - item.name is defined - item.scheduled | default(false) - - ansible_service_mgr != 'systemd' or restic_force_cron | default(false) - - restic_schedule_type == "cronjob" or restic_force_cron | default(false) + - ansible_service_mgr != 'systemd' or restic_force_cron | default(false) or restic_schedule_type == "cronjob" - name: make sure no unwanted systemd timer is available ansible.builtin.systemd: name: "restic-{{ item.name | replace(' ', '') | string }}.timer" - state: stopped + state: 'stopped' enabled: false + masked: true + with_items: '{{ restic_backups }}' when: - - restic_create_schedule + - restic_create_schedule | bool - item.name is defined - item.scheduled | default(false) - - ansible_service_mgr != 'systemd' or restic_force_cron | default(false) - - restic_schedule_type == "cronjob" or restic_force_cron | default(false) + - ansible_service_mgr != 'systemd' or restic_force_cron | default(false) or restic_schedule_type == "cronjob" + +- 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" diff --git a/vars/main.yml b/vars/main.yml index 000e1b6..45e177f 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -10,5 +10,5 @@ restic_os_variables: paths: - 'vars' -playbook_version_number: 13 # should be int +playbook_version_number: 14 # should be int playbook_version_path: 'do1jlr.restic.version'