ansible-role-backup-things/tasks/main.yml

25 lines
802 B
YAML

---
- 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 }}
{% if restic_compression is defined %}export RESTIC_COMPRESSION={{ restic_compression }}{% endif %}
{% if restic_build_command is defined %}
{{ restic_build_command }}
{% endif %}
restic backup {{ restic_directory }}
dest: "/etc/periodic/daily/backup_{{ ansible_play_name | replace(' ', '_') }}"
mode: 0755