ansible_role_restic/tasks/restic_delete_systemd.yml

61 lines
2 KiB
YAML
Raw Normal View History

---
2022-01-10 14:19:53 +01:00
- name: (SCHEDULE) (SYSTEMD) remove systemd timer
block:
2022-01-10 14:19:53 +01:00
- name: (SCHEDULE) (SYSTEMD) mask restic timer
become: true
ansible.builtin.systemd:
name: "restic-{{ item.name | replace(' ', '') | string }}.timer"
enabled: false
state: stopped
daemon_reload: true
masked: false
with_items: '{{ restic_backups }}'
ignore_errors: true
2022-01-10 14:31:25 +01:00
tags: skip_ansible_lint
failed_when: false
changed_when: false
when:
- item.name is defined
- item.scheduled | default(false)
- restic_schedule_type == "cronjob" or restic_force_cron | default(false)
2022-01-10 14:19:53 +01:00
- name: (SCHEDULE) (SYSTEMD) mask restic service
become: true
ansible.builtin.systemd:
name: "restic-{{ item.name | replace(' ', '') | string }}.service"
enabled: false
state: stopped
daemon_reload: true
masked: true
with_items: '{{ restic_backups }}'
when:
- item.name is defined
- item.scheduled | default(false)
- restic_schedule_type == "cronjob" or restic_force_cron | default(false)
ignore_errors: true
failed_when: false
2022-01-10 14:31:25 +01:00
tags: skip_ansible_lint
changed_when: false
2022-01-10 14:19:53 +01:00
- name: (SCHEDULE) (SYSTEMD) delete systemd .timer file
become: true
ansible.builtin.file:
path: "/lib/systemd/system/restic-{{ item.name | replace(' ', '') }}.timer"
state: absent
with_items: '{{ restic_backups }}'
when:
- item.name is defined
- item.scheduled | default(false)
- restic_schedule_type == "cronjob" or restic_force_cron | default(false)
2022-01-10 14:19:53 +01:00
- name: (SCHEDULE) (SYSTEMD) delete systemd .service file
become: true
ansible.builtin.file:
path: "/lib/systemd/system/restic-{{ item.name | replace(' ', '') }}.service"
state: absent
with_items: '{{ restic_backups }}'
when:
- item.name is defined
- item.scheduled | default(false)
- restic_schedule_type == "cronjob" or restic_force_cron | default(false)