fuzzymistborn.autorestic

Autorestic/Restic Installer

This is an Ansible role for installing and setting up restic and autorestic. The role was inspired by work from @IronicBadger and @ItsNotGoodName.

You can install it using the command: ansible-galaxy install fuzzymistborn.autorestic

Features

  • Installs and configures the restic and autorestic programs.
  • Copies and updates the autorestic configuration file.
  • Automatically updates the programs if there's a new version available.

Configuration

This role comes with various settings you can adjust.

You can set a specific version to install with autorestic_pinned_ver or restic_pinned_ver. By default, the role installs the latest version and updates it each time it runs. If you want to keep a specific version, you can set it like this:

autorestic_download_latest_ver: false
autorestic_pinned_ver: 1.2.0
restic_download_latest_ver: false
restic_pinned_ver: 0.12.1

When you pin a version, the updater won't run unless the installed version is different from what you set.

Other changeable settings include:

autorestic_config_user: root
autorestic_config_yaml: CHANGEME  # autorestic configuration in yaml
autorestic_config_path: "{{ autorestic_user_directory }}/.autorestic.yml"
autorestic_config_mode: 0600
autorestic_config_owner: "{{ autorestic_config_user }}"
autorestic_config_group: "{{ autorestic_config_user }}"

autorestic_distro: linux_amd64
restic_distro: linux_amd64

I suggest not changing other variables like restic_gh_url or restic_install_directory unless you want a custom installation.

To find the correct version for your installation, check the release pages for autorestic and restic.

Example Autorestic Config File

By default, the Autorestic configuration is saved in the root user's home directory. You can change the user with the autorestic_config_user variable.

Here's an example of the configuration options:

autorestic_config_yaml:
  locations:
    docker:
      from: '/opt/docker'
      to:
        - local
        - b2_docker
  backends:
    local:
      type: local
      path: /backup
      key: 123
    b2_docker:
      type: s3
      path: 'b2_backend_url'
      key: b2_password
      env:
        AWS_ACCESS_KEY_ID: 1234
        AWS_SECRET_ACCESS_KEY: 1234abc

For more details, check the official docs.

Github API

This role uses the GitHub API to find the latest available release. It normally sends requests without authentication, which is limited to 60 requests per hour. For most users, this isn't a big deal, but you might hit the limit. If you sign in, you can make 5,000 requests per hour.

To authenticate, create a Personal Access Token with no scopes selected. Then, add these variables:

github_api_user: fuzzymistborn
github_api_pass: YOUR_TOKEN
github_api_auth: yes

And that's it!

To Do

  • Add cron job variables for tasks (backup, forget, etc).
    • I’m no longer planning to do this due to the variety in how people set up these tasks.
  • Find a way to pin restic even while updating autorestic.

If you like my work, buy me a beer (or coffee, or something else)

ko-fi

Informazioni sul progetto

Installs restic/autorestic and creates backup configuration file

Installa
ansible-galaxy install fuzzymistborn.autorestic
Licenza
gpl-3.0
Download
44.3k
Proprietario