mirror of
https://github.com/roles-ansible/ansible_role_restic.git
synced 2024-12-11 23:41:32 +01:00
initializing repository
This commit is contained in:
parent
11e050f9af
commit
fc5ef9190e
2 changed files with 30 additions and 0 deletions
16
tasks/configure.yml
Normal file
16
tasks/configure.yml
Normal file
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
- name: Initialize repository
|
||||
command: '{{ restic_install_path }}/restic init'
|
||||
environment:
|
||||
RESTIC_REPOSITORY: '{{ item.value.location }}'
|
||||
RESTIC_PASSWORD: '{{ item.value.password }}'
|
||||
no_log: True
|
||||
register: restic_init
|
||||
changed_when: "'created restic repository' in restic_init.stdout"
|
||||
failed_when:
|
||||
- restic_init.rc != 0
|
||||
- not 'config file already exists' in restic_init.stderr
|
||||
loop: "{{ restic_repos|dict2items }}"
|
||||
when:
|
||||
- item.value.init is defined
|
||||
- item.value.init == true
|
|
@ -32,8 +32,22 @@
|
|||
group: '{{ restic_dir_group }}'
|
||||
with_items: '{{ restic_create_paths }}'
|
||||
|
||||
- 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
|
||||
|
||||
- name: Install restic
|
||||
include: 'install.yml'
|
||||
when: not restic_executable.stat.exists or not restic_installed.stat.exists
|
||||
|
||||
- name: Configure restic
|
||||
include: 'configure.yml'
|
||||
|
||||
- name: include distribution tasks
|
||||
include_tasks: '{{ loop_distribution }}'
|
||||
|
|
Loading…
Reference in a new issue