base/roles/restic/tasks/main.yml

31 lines
979 B
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_unit_naming_scheme }}.timer"
enabled: true
- name: Ensure systemd timer for '{{ restic_job_name }}' is {{ restic_job_state }}
ansible.builtin.systemd:
name: "{{ restic_systemd_unit_naming_scheme }}.timer"
state: started # TODO: mask a timer?