2019-08-13 13:52:25 +02:00
|
|
|
---
|
2022-01-10 14:19:53 +01:00
|
|
|
- name: (CONF)Initialize repository
|
2022-04-01 11:07:12 +02:00
|
|
|
ansible.builtin.command: '{{ restic_install_path }}/restic init'
|
2019-08-13 13:52:25 +02:00
|
|
|
environment:
|
|
|
|
RESTIC_REPOSITORY: '{{ item.value.location }}'
|
|
|
|
RESTIC_PASSWORD: '{{ item.value.password }}'
|
2020-06-02 19:45:52 +02:00
|
|
|
AWS_ACCESS_KEY_ID: '{{ item.value.aws_access_key | default("") }}'
|
2023-02-25 20:29:44 +01:00
|
|
|
AWS_SECRET_ACCESS_KEY: '{{ item.value.aws_secret_access_key | default("") }}'
|
2020-06-02 19:45:52 +02:00
|
|
|
AWS_DEFAULT_REGION: '{{ item.value.aws_default_region | default("") }}'
|
2023-08-23 21:54:30 +02:00
|
|
|
AZURE_ACCOUNT_NAME: '{{ item.value.azure_account_name | default("") }}'
|
|
|
|
AZURE_ACCOUNT_KEY: '{{ item.value.azure_account_key | default("") }}'
|
|
|
|
AZURE_ACCOUNT_SAS: '{{ item.value.azure_account_sas | default("") }}'
|
|
|
|
AZURE_ENDPOINT_SUFFIX: '{{ item.value.azure_endpoint_suffix | default("") }}'
|
2020-09-08 10:17:46 +02:00
|
|
|
B2_ACCOUNT_ID: '{{ item.value.b2_account_id | default("") }}'
|
|
|
|
B2_ACCOUNT_KEY: '{{ item.value.b2_account_key | default("") }}'
|
2021-08-03 23:16:34 +02:00
|
|
|
no_log: "{{ restic_no_log }}"
|
2019-08-13 13:52:25 +02:00
|
|
|
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
|
2020-06-02 15:58:43 +02:00
|
|
|
- not 'config already initialized' in restic_init.stderr
|
2020-11-12 18:42:56 +01:00
|
|
|
- not 'config already exists' in restic_init.stderr
|
2022-10-06 14:52:27 +02:00
|
|
|
loop: "{{ restic_repos | dict2items }}"
|
2019-08-13 13:52:25 +02:00
|
|
|
when:
|
|
|
|
- item.value.init is defined
|
2021-06-15 19:48:23 +02:00
|
|
|
- item.value.init|bool
|