Ansible

Installation using Ansible

Installation using Ansible is not streamlined, but here’s the playbook I’m using on my servers:

This is very much work in progress. Once I get a stable ansible script I should publish it to Ansible Galaxy.

The playbook is installing (or upgrading):

  • latest restic binary to /usr/local/bin
  • latest resticprofile binary to /usr/local/bin
  • the resticprofile configuration file from a template file found in ./resticprofile/{{ inventory_hostname }}/profiles.* to /root/resticprofile/profiles.*
  • password files that can be encrypted using ansible vault. These files are located in ./resticprofile/{{ inventory_hostname }}/keys/*: they will be decrypted and saved to /root/resticprofile/.
  • other files (like files needed for --exclude-file, --files-from or anything else you need) from ./resticprofile/{{ inventory_hostname }}/copy/* to /root/resticprofile/
Warning

The playbook needs the python package github3, which in turn needs a whole bunch of package including cryptography, which in turn needs the libssl-dev package (on debian) and a rust compiler.

I can tell you it takes forever to compile and install all this on a Raspberry Pi 3.

Please note the installation of a rust compiler is not part of this playbook.

Requirements

Each target machine must have one variable named arch containing the resticprofile OS & Arch. You can see a list of all the available OS & Arch couples on the releases page.

Typically, a binary will be distributed using this convention:

resticprofile-[VERSION]_[OS]_[ARCH].tar.gz

Your host variables file should declare a arch variable containing the [OS]_[ARCH] part of the file name.

Examples:

arch: linux_amd64

or for a Raspberry pi 3+:

arch: linux_armv7

Note: I might find a way to detect this automatically at some point