Ansible
We provide a ready-to-use Ansible role to install Borg, Borgmatic, and a cron job on a Linux client (tested on Ubuntu/Debian/CentOS/Fedora). Example usage in a playbook:
- hosts: webservers roles: - role: borgbase.ansible_role_borgbackup borgbackup_config: encryption_passphrase: CHANGEME repositories: - ssh://m5vz9gp4@m5vz9gp4.repo.borgbase.com/./repo source_directories: - /srv/www - /var/lib/automysqlbackupSteps to Use This Role
Section titled “Steps to Use This Role”- Install via Ansible Galaxy or clone the GitHub repository into your
rolesfolder. - Add a new repository without an SSH key in BorgBase.
- Replace the Borg passphrase, repository URL, and source directories in your playbook.
- Run the playbook against the client host. A new SSH key will be created and displayed.
- Add the new SSH key under SSH Keys in BorgBase and assign it to your repository.
- Run
sudo borgmatic repo-create --encryption repokey-blake2on the client to validate the connection and initialize the new repository.
Learn more on the GitHub page of the project.
Interacting With the BorgBase API via Ansible
Section titled “Interacting With the BorgBase API via Ansible”Andy Hawkins has created a range of Ansible modules that interact with the BorgBase API for a fully automated setup. They allow adding a repository or SSH key to BorgBase. Install the collection from Ansible Galaxy:
ansible-galaxy collection install adhawkins.borgbaseFor more details, see the GitHub repo or the module documentation.