vrischmann.restic

Restic

Set up backups with restic using systemd services and timers.

This setup has two options:

  • user: Adds services and timers for your regular user.
  • server: Adds services and timers for the whole system.

Requirements

You need to have restic installed and your repositories set up.

Role Variables

Name Required Description
restic_binary no Full path to the restic program.
restic_backup_mode yes Backup mode ("user" or "server").
restic_user_home no User's home directory (for "user" mode).
restic_user_name no User's name (for "user" mode).
restic_user_group no User's group (for "user" mode).
restic_backups yes List of backup settings for restic.
restic_conf_directory no Configuration folder (for "server" mode).

Backup Definition

The restic_backups list includes items that define backups.

Each backup entry must have:

  • Repository name (for systemd services: use only letters and numbers)
  • Environment variables for restic to access the repository
  • Schedule for the systemd timer.
  • Directories to back up

You can also include directories to exclude.

For example, this defines two repositories:

restic_backups:
  - name: remote-scaleway
    env:
      AWS_ACCESS_KEY_ID: "{{ restic_scaleway_aws_access_key_id }}"
      AWS_SECRET_ACCESS_KEY: "{{ restic_scaleway_aws_secret_access_key }}"
      RESTIC_REPOSITORY: "s3:s3.fr-par.scw.cloud/foobar/home"
      RESTIC_PASSWORD: "{{ restic_remote_password }}"
    calendar_spec: "*-*-* *:00/15:00"
    backup_directories:
      - /home/vincent
    excludes:
      - /home/vincent/tmp

  - name: remote-linode
    env:
      AWS_ACCESS_KEY_ID: "{{ restic_linode_aws_access_key_id }}"
      AWS_SECRET_ACCESS_KEY: "{{ restic_linode_aws_secret_access_key }}"
      RESTIC_REPOSITORY: "s3:eu-central-1.linodeobjects.com/foobar/barbaz"
      RESTIC_PASSWORD: "{{ restic_remote_password }}"
    calendar_spec: "*-*-* *:00/15:00"
    backup_directories:
      - /data/media
    excludes:
      - /data/media/Movies

License

MIT

Informazioni sul progetto

Deploy restic backups using systemd services and timers

Installa
ansible-galaxy install vrischmann.restic
Licenza
mit
Download
134
Proprietario
Still learning