{"id":26414220,"url":"https://github.com/borisskert/ansible-borgbackup","last_synced_at":"2026-02-07T01:07:06.443Z","repository":{"id":104037030,"uuid":"259097211","full_name":"borisskert/ansible-borgbackup","owner":"borisskert","description":"An ansible installation and setup role for borgbackup","archived":false,"fork":false,"pushed_at":"2024-12-18T14:13:55.000Z","size":104,"stargazers_count":1,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-18T14:49:34.901Z","etag":null,"topics":["ansible","ansible-role","borg","borgbackup","debian","molecule","systemd","systemd-unit","ubuntu"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/borisskert.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-26T17:55:27.000Z","updated_at":"2024-03-09T20:00:23.000Z","dependencies_parsed_at":"2024-12-18T14:44:50.961Z","dependency_job_id":"552bac04-b8ab-470b-a666-a8a965388849","html_url":"https://github.com/borisskert/ansible-borgbackup","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borisskert%2Fansible-borgbackup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borisskert%2Fansible-borgbackup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borisskert%2Fansible-borgbackup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borisskert%2Fansible-borgbackup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/borisskert","download_url":"https://codeload.github.com/borisskert/ansible-borgbackup/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244130273,"owners_count":20402753,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","ansible-role","borg","borgbackup","debian","molecule","systemd","systemd-unit","ubuntu"],"created_at":"2025-03-17T23:58:15.506Z","updated_at":"2026-02-07T01:07:01.412Z","avatar_url":"https://github.com/borisskert.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ansible-borgbackup\n\nInstalls [borg backup](https://www.borgbackup.org) and set up a systemd service.\n\n## System requirements\n\n* Systemd (if you want to set up a service)\n\n## What this role does\n\n* Installs borg from the [borg GitHub repo](https://github.com/borgbackup/borg)\n* Create passphrase files\n* Template backup script\n* Create systemd service\n* Create systemd timer\n\n## Parameters\n\n| Parameter name                         | Type            | Mandatory?                                            | Default value             | Description                                                                                                                                          |\n|----------------------------------------|-----------------|-------------------------------------------------------|---------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------|\n| borgbackup_version                     |                 | no                                                    | [empty] =\u003e latest version | Specifies the version of borg to be installed                                                                                                        |\n| borgbackup_working_directory           | absolute path   | no, only if you specify repos with encryption enabled | `''`                      | Specifies the location where your passphrase files will be stored                                                                                    |\n| borgbackup_repos                       | array of `repo` | no                                                    | `[]`                      | Specifies the repos for your backup                                                                                                                  |\n| borgbackup_ignore_failing_repos        | boolean         | no                                                    | `false`                   | By default your ansible playbook will fail if a repo fails to be initialized. Setting this property to `True` will ignore and omit all failing repos |\n| borgbackup_no_strict_host_key_checking | boolean         | no                                                    | `false`                   | You can disable ssh strict host key checking with setting this switch to `yes`                                                                       |\n| borgbackup_backup_devices              | array of texts  | no                                                    | `[]`                      | You can specify any backup drives which will be mounted before beackup and unmounted after (i. e. you can use USB drives)                            |\n| borgbackup_install_from_apt            | boolean         | no                                                    | `false`                   | You can install the package `borgbackup` from `apt` if you wish                                                                                      |\n| borgbackup_install_from_pip            | boolean         | no                                                    | `false`                   | You can install the package `borgbackup` from `pip` if you wish                                                                                      |\n| borgbackup_linuxold                    | boolean         | no                                                    | `false`                   | Install `linuxold64` version for older linux versions (only if you don't install from `apt` and `pip`)                                               |\n\n### Definition `repo`\n\n| Parameter name        | Type               | Mandatory? | Default value | Description                                                                                                            |\n|-----------------------|--------------------|------------|---------------|------------------------------------------------------------------------------------------------------------------------|\n| repo_path             | absolute path      | yes        | [empty]       | Specifies the location of your repo. Also, ssh repos are supported. Make sure you have permissions to connect via ssh. |\n| encryption_mode       | enum               | yes        | [empty]       | Specifies the encryption mode borg will use for this repo. Allowed: `repokey`, `repokey-blake2`                        |\n| encryption_passphrase | text               | yes        | [empty]       | Your secret passphrase for your encrypted repo                                                                         |\n| passphrase_filename   | file_name          | yes        | [empty]       | Filename of your passphrase file stored in `borgbackup_working_directory`                                              |\n| archives              | array of `archive` | yes        | []            | The defined archives which will be stored in this repo                                                                 |\n| prune                 | `prune` object     | no         | {}            | Containing your prune settings for this repo (recommended!)                                                            |\n| disable_repo          | boolean            | no         | no            | You can disable a repo with this switch                                                                                |\n\n### Definition `archive`\n\n| Parameter name   | Type                    | Mandatory? | Default value | Description                                                                                                             |\n|------------------|-------------------------|------------|---------------|-------------------------------------------------------------------------------------------------------------------------|\n| name             | text                    | yes        | [empty]       | Specified the name of your archive                                                                                      |\n| compression_mode | enum                    | no         | [empty]       | Specified the compression mode and level. Read the [docs](https://borgbackup.readthedocs.io/en/stable/usage/prune.html) |\n| paths            | array of absolute paths | yes        | [empty]       | Specifies the paths which will be selected for backup into your archive. Specify at least one                           |\n| exclude          | array of `exclude`      | no         | [empty]       | Specifies the exclude configuration for your archive.                                                                   |\n\n### Definition `prune`\n\n| Parameter name  | Type    | Mandatory? | Default value             | Description                                                                   |\n|-----------------|---------|------------|---------------------------|-------------------------------------------------------------------------------|\n| keep_within     | text    | no         | [none]                    | Read the [docs](https://borgbackup.readthedocs.io/en/stable/usage/prune.html) |\n| keep_daily      | integer | no         | [none]                    | Read the [docs](https://borgbackup.readthedocs.io/en/stable/usage/prune.html) |\n| keep_weekly     | integer | no         | [none]                    | Read the [docs](https://borgbackup.readthedocs.io/en/stable/usage/prune.html) |\n| keep_monthly    | integer | no         | [none]                    | Read the [docs](https://borgbackup.readthedocs.io/en/stable/usage/prune.html) |\n\n### Definition `exclude`\n\n| Parameter name | Type             | Mandatory? | Default value | Description                                                                                                                                     |\n|----------------|------------------|------------|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------|\n| patterns       | array of strings | no         | [empty]       | Specifies the patterns which will be excluded from your archive. Read the [docs](https://borgbackup.readthedocs.io/en/stable/usage/create.html) |\n\n## Usage\n\n### Add to `requirements.yml`\n\n```yaml\n- name: setup-borgbackup\n  src: https://github.com/borisskert/ansible-borgbackup.git\n  scm: git\n```\n\n### Minimal `playbook.yml`\n\n```yaml\n- hosts: test_machine\n  become: yes\n\n  roles:\n    - setup-borgbackup\n```\n\n### Typical `playbook.yml`\n\n```yaml\n- hosts: test_machine\n  become: yes\n\n  roles:\n    - role: setup-borgbackup\n      borgbackup_version: 1.4.0\n      borgbackup_install_from_apt: false\n      borgbackup_install_from_pip: false\n      borgbackup_linuxold: false\n      borgbackup_working_directory: /srv/borgbackup\n      borgbackup_backup_devices:\n        - /dev/my_drive\n        - /dev/my_other_drive\n      borgbackup_repos:\n        - repo_path: /mnt/borgbackups/etc-backups\n          encryption_mode: repokey\n          encryption_passphrase: \"thi5 is-mY_p@5sphr4s3 for /etc\"\n          passphrase_filename: etc_passphrase.txt\n          prune:\n            keep_within: 1d\n            keep_daily: 7\n            keep_weekly: 4\n            keep_monthly: 12\n          archives:\n            - name: etc-archive\n              compression_mode: lzma,4\n              paths:\n                - /etc\n        - repo_path: /mnt/borgbackups/home-and-root-backups\n          encryption_mode: repokey-blake2\n          encryption_passphrase: \"thi5 is-mY_p@5sphr4s3 for /home and /root\"\n          passphrase_filename: home_root_passphrase.txt\n          prune:\n            keep_daily: 7\n          archives:\n            - name: home-archive\n              compression_mode: none\n              paths:\n                - /home\n            - name: root-archive\n              compression_mode: none\n              paths:\n                - /root\n        - repo_path: /mnt/borgbackups/opt-backups\n          prune:\n            keep_weekly: 4\n            keep_monthly: 12\n          archives:\n            - name: opt-archive\n              compression_mode: none\n              paths:\n                - /opt\n        - repo_path: ssh://my_ssh_user@remote_server.org//home/my_remote_path\n          encryption_mode: repokey\n          encryption_passphrase: \"thi5 is-mY_p@5sphr4s3\"\n          passphrase_filename: remote_backup_passphrase.txt\n          archives:\n            - name: my-remote-archive\n              compression_mode: lzma,9\n              paths:\n                - /etc\n                - /home\n                - /srv\n                - /root\n              exclude:\n                patterns:\n                  - '*.tmp'\n                  - '*.log'\n                  - '*.swp'\n                  - '*.cache'\n        - repo_path: ssh://disabled_user@disabled_server//borgbackup-test\n          disable_repo: yes\n          archives:\n            - name: my-disabled-archive\n              compression_mode: lzma,9\n              paths:\n                - /etc\n                - /home\n                - /srv\n                - /root\n              exclude:\n                patterns:\n                  - '*.tmp'\n                  - '*.log'\n                  - '*.swp'\n                  - '*.cache'\n```\n\n## Testing\n\nRequirements:\n\n* [Vagrant](https://www.vagrantup.com/)\n* [libvirt](https://libvirt.org/)\n* [Ansible](https://docs.ansible.com/)\n* [Molecule](https://molecule.readthedocs.io/en/latest/index.html)\n* [yamllint](https://yamllint.readthedocs.io/en/stable/#)\n* [ansible-lint](https://docs.ansible.com/ansible-lint/)\n* [Docker](https://docs.docker.com/)\n\n### Run within docker\n\n```shell script\nmolecule test\n```\n\n### Run within Vagrant\n\n```shell script\n molecule test --scenario-name vagrant --parallel\n```\n\nI recommend to use [pyenv](https://github.com/pyenv/pyenv) for local testing. Within the GitHub Actions pipeline I\nuse [my own molecule action](https://github.com/borisskert/molecule-action).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fborisskert%2Fansible-borgbackup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fborisskert%2Fansible-borgbackup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fborisskert%2Fansible-borgbackup/lists"}