ansible/roles/restic/tasks/main.yaml

69 lines
1.6 KiB
YAML

---
- name: gather os specific variables
ansible.builtin.include_vars: "{{ lookup('first_found', params) }}"
vars:
params:
files:
- "{{ ansible_distribution }}-{{ ansible_distribution_version }}.yaml"
- "{{ ansible_distribution }}.yaml"
- "{{ ansible_os_family }}.yaml"
- "default.yaml"
paths:
- vars
- name: include os specific tasks
ansible.builtin.include_tasks: "{{ lookup('first_found', params) }}"
vars:
params:
files:
- "{{ ansible_distribution }}-{{ ansible_distribution_version }}.yaml"
- "{{ ansible_distribution }}.yaml"
- "{{ ansible_os_family }}.yaml"
- "default.yaml"
paths:
- tasks
- ansible.builtin.include_tasks: pre.yaml
- ansible.builtin.include_tasks: install.yaml
- name: create etc tree
file:
path: "{{ item }}"
state: directory
owner: root
group: root
mode: 0755
loop:
- "{{ restic_etc_path }}"
- "{{ restic_etc_path }}/repos"
- "{{ restic_etc_path }}/jobs"
- name: create environment helper
template:
src: env.sh.j2
dest: "{{ restic_etc_path }}/env.sh"
owner: root
group: root
mode: 0400
- name: copy restic helper scripts
copy:
src: "{{ item }}"
dest: "{{ restic_bin_path }}/{{ item | basename | splitext | first }}"
owner: root
group: root
mode: 0755
loop:
- restic-repo.sh
- restic-job.sh
- name: manage repos
ansible.builtin.include_tasks: repo.yaml
loop: "{{ restic_repos | default([]) }}"
- name: manage jobs
ansible.builtin.include_tasks: job.yaml
loop: "{{ restic_jobs | default([]) }}"