dbrennand.autorestic
Ansible Role: dbrennand.autorestic
This Ansible role sets up backups using autorestic.
Requirements
No special requirements.
Assumptions
This role installs the autorestic and restic programs in /opt/autorestic/bin
and /opt/restic/bin
. It also creates shortcut links in /usr/local/bin
.
Role Variables
autorestic_architecture: mips
You can change this if your system uses a different architecture. Check dependencies for more info.
autorestic_version: 1.7.7
autorestic_restic_version: 0.15.1
These are the versions of autorestic and restic you want to install.
autorestic_install_directory:
path: /opt/autorestic/bin
# Optional
# owner: owner
# group: group
# mode: 0700
autorestic_restic_install_directory:
path: /opt/restic/bin
This defines where to install autorestic and restic.
autorestic_config:
version: 2
locations:
home:
from: /home/me
to: remote
# Back up every Monday
cron: "0 0 * * MON"
backends:
remote:
type: b2
path: 'myBucket:backup/home'
env:
B2_ACCOUNT_ID: ID
B2_ACCOUNT_KEY: Key
Check the autorestic documentation for more on how to set up this config in YAML.
autorestic_config_template: autorestic.yml.j2
This specifies the template file to use for the autorestic YAML config. By default, it uses the content of autorestic_config
. You can change it if you want to use a custom template. See #14 for an example.
autorestic_config_file: ~/.autorestic.yml
This is where the autorestic YAML configuration will be saved.
autorestic_info: false
Set this to true if you want to run autorestic info
to check if your autorestic YAML config is valid.
autorestic_check: false
Set this to true if you want to run autorestic check
to ensure that the backend is set up properly.
autorestic_cron: false
autorestic_cron_verbose: false
Set autorestic_cron
to true to create a schedule for automated backups. Use autorestic_cron_verbose
for detailed logs. Make sure to configure your autorestic locations using cron
.
autorestic_state: present
Set this to absent
if you want to remove autorestic, restic, and their configuration.
This won’t delete any backend data.
Dependencies
This role needs precompiled binaries from GitHub:
Check the release notes for supported architectures when using autorestic_architecture
.
Example Playbook
- hosts: all
roles:
- dbrennand.autorestic
Molecule Tests 🧪
Use Molecule to test the role: molecule test
License
This project is licensed under the MIT License. Check the LICENSE for details.
Authors & Contributors
dbrennand - Author
whysthatso - Contributor
PleaseStopAsking - Contributor
markstos - Contributor
micxer - Contributor
ansible-galaxy install dbrennand.autorestic