1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_restic.git synced 2024-12-11 23:41:32 +01:00
ansible_role_restic/tasks/main.yml

52 lines
1.5 KiB
YAML
Raw Normal View History

2019-08-13 13:26:40 +02:00
---
- name: add OS specific variables
2021-03-23 16:16:20 +01:00
ansible.builtin.include_vars: "{{ lookup('first_found', restic_os_variables) }}"
2019-08-13 13:26:40 +02:00
- name: Ensure restic directories exist
file:
state: 'directory'
path: '{{ item }}'
mode: '0755'
owner: '{{ restic_dir_owner }}'
group: '{{ restic_dir_group }}'
with_items: '{{ restic_create_paths }}'
2019-08-13 13:52:25 +02:00
- name: Check if downloaded binary is present
stat:
path: '{{ restic_download_path }}/bin/restic-{{ restic_version }}'
register: restic_executable
- name: Check if installed binary is present
stat:
path: '{{ restic_install_path }}/restic'
register: restic_installed
2019-08-13 13:26:40 +02:00
- name: Install restic
include: 'install.yml'
2019-08-13 13:52:25 +02:00
when: not restic_executable.stat.exists or not restic_installed.stat.exists
- name: Configure restic
include: 'configure.yml'
2019-08-13 13:26:40 +02:00
- name: include distribution tasks
include_tasks: '{{ loop_distribution }}'
with_first_found:
- files:
- '{{ distribution }}-{{ distribution_version }}.yml'
- '{{ distribution }}-{{ distribution_major_version }}.yml'
- '{{ distribution }}.yml'
- '{{ ansible_os_family }}.yml'
- '{{ ansible_system }}.yml'
- 'defaults.yml'
paths:
- 'distribution'
loop_control:
loop_var: loop_distribution
vars:
distribution: '{{ ansible_distribution }}'
distribution_version: '{{ ansible_distribution_version }}'
distribution_major_version: '{{ ansible_distribution_major_version }}'
tags:
- configuration
- packages