Skip to content

Latest commit

 

History

History
59 lines (48 loc) · 1.58 KB

README.md

File metadata and controls

59 lines (48 loc) · 1.58 KB

Borgbackup

Ansible Borgbackup role.

Features:

  • Repository or binary installation
  • Schedules regular backup jobs
  • Schedules regular prune jobs to keep backup windows clean
  • Flexible configuration to list backup targets

Role Variables

see defaults/main.yml

Example Playbook

- hosts: all
  roles:
    - role: SphericalElephant.borgbackup
      borgbackup_client: True
      borgbackup_client_backup_server: backup01.example.com
      borgbackup_create_jobs:
        - name: system
          day: "*"
          hour: "0"
          minute: "{{ 59 | random }}"
          directories:
            - /etc
            - /home
            - /var
          excludes:
            - 're:^/var/lib/apt'
            - 're:^/var/[^/]+\/cache/'
      borgbackup_prune_jobs:
        - name: system
          prune_options: "--keep-daily=7 --keep-weekly=4"
          day: "*"
          hour: "8"
          minute: "0"
      borgbackup_check_jobs:
        - name: system
          check_options: "--lock-wait 28800"
          day: "1"
          hour: "12"
          minute: "0"

You can easily assign client and server attributes from your inventory with something similar to the following:

borgbackup_client: "{{ (inventory_hostname in groups.borgbackup_server)|ternary(False, True) }}"
borgbackup_client_backup_server: "{{ groups.borgbackup_server[0] }}"

License

Apache 2.0