40 lines
1.2 KiB
YAML
40 lines
1.2 KiB
YAML
---
|
|
- name: Check if role input is valid
|
|
ansible.builtin.include_tasks:
|
|
file: check.yml
|
|
|
|
- name: Ensure restic is {{ restic_state }}
|
|
ansible.builtin.include_tasks:
|
|
file: install.yml
|
|
|
|
- name: Ensure restic user '{{ restic_user }}' is {{ restic_state }}
|
|
ansible.builtin.user:
|
|
name: "{{ restic_user }}"
|
|
state: "{{ restic_state }}"
|
|
system: "{{ restic_user_system }}"
|
|
create_home: "{{ restic_user_create_home }}"
|
|
when: restic_create_user
|
|
|
|
- name: Ensure restic configuration for job is {{ restic_job_state }}
|
|
ansible.builtin.include_tasks:
|
|
file: "configure.yml"
|
|
|
|
- name: Ensure systemd timer for '{{ restic_job_name }}' is activated
|
|
ansible.builtin.systemd:
|
|
name: "{{ restic_systemd_timer_naming_scheme }}"
|
|
enabled: true
|
|
when:
|
|
- restic_systemd_timer_info.changed
|
|
- not restic_systemd_timer_info.failed
|
|
- not ansible_check_mode
|
|
|
|
- name: Ensure systemd timer for '{{ restic_job_name }}' is {{ restic_job_state }}
|
|
ansible.builtin.systemd:
|
|
name: "{{ restic_systemd_timer_naming_scheme }}"
|
|
state: "{{ restic_job_state }}"
|
|
masked: "{{ (restic_job_state == 'masked') | ternary('true', omit) }}"
|
|
when:
|
|
- restic_systemd_timer_info.changed
|
|
- not restic_systemd_timer_info.failed
|
|
- not ansible_check_mode
|