Initial commit

This commit is contained in:
nemunaire 2023-07-13 11:30:51 +02:00
commit 42f4a74218
2 changed files with 37 additions and 0 deletions

18
meta/main.yml Normal file
View File

@ -0,0 +1,18 @@
---
dependencies: []
galaxy_info:
role_name: backup-things
author: 'Pierre-Olivier Mercier <nemunaire+iac@nemunai.re>'
description: Backup things
license: GPL-3.0-or-later
min_ansible_version: 2.9
platforms:
- name: Alpine
versions:
- all
- name: Debian
versions:
- all
galaxy_tags: []

19
tasks/main.yml Normal file
View File

@ -0,0 +1,19 @@
---
- name: Install restic
apk:
name:
- restic
- name: setup backup throught cron
ansible.builtin.copy:
content: |
#!/bin/sh
export AWS_ACCESS_KEY_ID={{ restic_aws_access_key_id | to_json }}
export AWS_SECRET_ACCESS_KEY={{ restic_aws_secret_access_key | to_json }}
export RESTIC_REPOSITORY="s3:{{ restic_aws_endpoint }}/{{ restic_aws_bucket_name }}"
export RESTIC_PASSWORD={{ restic_password | to_json }}
restic backup {{ restic_directory }}
dest: "/etc/periodic/daily/backup_{{ ansible_play_name | replace(' ', '_') }}"
mode: 0755