mirror of
				https://github.com/borgbase/ansible-role-borgbackup.git
				synced 2025-11-04 01:19:32 +01:00 
			
		
		
		
	Test and dependency fixes (#153)
This commit is contained in:
		
							parent
							
								
									ad163fec68
								
							
						
					
					
						commit
						c8a295aa26
					
				@ -1,6 +1,6 @@
 | 
			
		||||
# Ansible Role: BorgBackup Client
 | 
			
		||||
 | 
			
		||||
[](https://github.com/borgbase/ansible-role-borgbackup/actions/workflows/main.yml) [](https://galaxy.ansible.com/borgbase/ansible_role_borgbackup)
 | 
			
		||||
[](https://github.com/borgbase/ansible-role-borgbackup/actions/workflows/main.yml) [](https://galaxy.ansible.com/ui/standalone/roles/borgbase/ansible_role_borgbackup/)
 | 
			
		||||
 | 
			
		||||
Set up encrypted, compressed and deduplicated backups using [BorgBackup](https://borgbackup.readthedocs.io/en/stable/) and [Borgmatic](https://github.com/witten/borgmatic). Currently supports Debian/Ubuntu, CentOS/Red Hat/Fedora, Archlinux and Manjaro.
 | 
			
		||||
 | 
			
		||||
@ -19,12 +19,13 @@ Works great with [BorgBase.com](https://www.borgbase.com) - Simple and Secure Ho
 | 
			
		||||
  Systemd timers, be sure to remove the Cron job in `/etc/cron.d/borgmatic` first.
 | 
			
		||||
  The role will also alert you when trying to use both timers.
 | 
			
		||||
 | 
			
		||||
## Example playbook with root as backup user and Cron timer
 | 
			
		||||
## Example playbook with root as backup user, using the distro package and Cron timer
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
- hosts: all
 | 
			
		||||
  roles:
 | 
			
		||||
  - role: borgbase.ansible_role_borgbackup
 | 
			
		||||
    borg_install_method: package
 | 
			
		||||
    borg_encryption_passphrase: CHANGEME
 | 
			
		||||
    borg_repository:
 | 
			
		||||
      - ssh://xxxxxx@xxxxxx.repo.borgbase.com/./repo
 | 
			
		||||
 | 
			
		||||
@ -46,4 +46,6 @@ borgmatic_version: ">=1.7.11"
 | 
			
		||||
borg_venv_path: "/opt/borgmatic"
 | 
			
		||||
borg_user: "root"
 | 
			
		||||
borg_group: "root"
 | 
			
		||||
backup_user_info:
 | 
			
		||||
  home: "/home/{{ borg_user }}"
 | 
			
		||||
...
 | 
			
		||||
 | 
			
		||||
@ -50,7 +50,7 @@ argument_specs:
 | 
			
		||||
        default: root
 | 
			
		||||
        description: Name of the Group to create Backups (Service Account)
 | 
			
		||||
      borg_source_directories:
 | 
			
		||||
        type: List
 | 
			
		||||
        type: list
 | 
			
		||||
        default: "/etc/hostname"
 | 
			
		||||
        required: false
 | 
			
		||||
        description: List of local folders to back up.
 | 
			
		||||
@ -59,7 +59,7 @@ argument_specs:
 | 
			
		||||
        required: false
 | 
			
		||||
        description: Don't cross file-system boundaries.
 | 
			
		||||
      borg_repository:
 | 
			
		||||
        type: List
 | 
			
		||||
        type: str
 | 
			
		||||
        required: true
 | 
			
		||||
        description: |
 | 
			
		||||
          Full path to repository.
 | 
			
		||||
@ -75,11 +75,11 @@ argument_specs:
 | 
			
		||||
        required: false
 | 
			
		||||
        description: Store ctime into archive.
 | 
			
		||||
      borg_exclude_patterns:
 | 
			
		||||
        type: List
 | 
			
		||||
        type: list
 | 
			
		||||
        required: false
 | 
			
		||||
        description: Any paths matching these patterns are excluded from backups. Globs and tildes are expanded.
 | 
			
		||||
      borg_exclude_from:
 | 
			
		||||
        type: List
 | 
			
		||||
        type: list
 | 
			
		||||
        required: false
 | 
			
		||||
        description: Read exclude patterns from one or more separate named files, one pattern per line.
 | 
			
		||||
      borg_remote_path:
 | 
			
		||||
@ -144,7 +144,7 @@ argument_specs:
 | 
			
		||||
          required: false
 | 
			
		||||
          description: Number of yearly archives to keep.
 | 
			
		||||
      borgmatic_checks:
 | 
			
		||||
        type: List
 | 
			
		||||
        type: list
 | 
			
		||||
        required: false
 | 
			
		||||
        description: |
 | 
			
		||||
          List of one or more consistency checks to run
 | 
			
		||||
 | 
			
		||||
@ -15,9 +15,7 @@ galaxy_info:
 | 
			
		||||
        - all
 | 
			
		||||
    - name: Ubuntu
 | 
			
		||||
      versions:
 | 
			
		||||
        - trusty
 | 
			
		||||
        - xenial
 | 
			
		||||
        - bionic
 | 
			
		||||
        - all
 | 
			
		||||
    - name: ArchLinux
 | 
			
		||||
      versions:
 | 
			
		||||
        - all
 | 
			
		||||
 | 
			
		||||
@ -19,6 +19,17 @@
 | 
			
		||||
        name: "{{ openssh_package }}"
 | 
			
		||||
        state: present
 | 
			
		||||
 | 
			
		||||
    - name: Enable EPEL for yamllint
 | 
			
		||||
      package:
 | 
			
		||||
        name: epel-release
 | 
			
		||||
        state: present
 | 
			
		||||
      when: ansible_os_family == 'RedHat' and ansible_distribution != 'Fedora'
 | 
			
		||||
 | 
			
		||||
    - name: Install yamllint
 | 
			
		||||
      package:
 | 
			
		||||
        name: yamllint
 | 
			
		||||
        state: present
 | 
			
		||||
 | 
			
		||||
  roles:
 | 
			
		||||
    - role: borgbase.ansible_role_borgbackup
 | 
			
		||||
      borg_install_method: pip
 | 
			
		||||
@ -42,11 +53,3 @@
 | 
			
		||||
        - name: users
 | 
			
		||||
          hostname: database1.example.org
 | 
			
		||||
          port: 5433
 | 
			
		||||
 | 
			
		||||
  post_tasks:
 | 
			
		||||
  - name: Install yamllint for checking config file
 | 
			
		||||
    pip:
 | 
			
		||||
      name: yamllint
 | 
			
		||||
      executable: pip3
 | 
			
		||||
      extra_args: "{{ pip3_extra_args }}"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -10,8 +10,8 @@ platforms:
 | 
			
		||||
    image: almalinux:9
 | 
			
		||||
  - name: fedora-latest
 | 
			
		||||
    image: fedora:latest
 | 
			
		||||
  - name: debian-bullseye
 | 
			
		||||
    image: debian:bullseye
 | 
			
		||||
  - name: debian-bookworm
 | 
			
		||||
    image: debian:bookworm
 | 
			
		||||
  - name: ubuntu-latest
 | 
			
		||||
    image: ubuntu:latest
 | 
			
		||||
provisioner:
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,12 @@
 | 
			
		||||
---
 | 
			
		||||
- name: Install Borg and Borgmatic via pip
 | 
			
		||||
  block:
 | 
			
		||||
    - name: Ensure the crb repository is enabled for RedHat (needed for xxhash)
 | 
			
		||||
      community.general.dnf_config_manager:
 | 
			
		||||
        name: crb
 | 
			
		||||
        state: enabled
 | 
			
		||||
      when: ansible_os_family == 'RedHat' and ansible_distribution != 'Fedora'
 | 
			
		||||
 | 
			
		||||
    - name: Install build dependencies
 | 
			
		||||
      ansible.builtin.package:
 | 
			
		||||
        name: "{{ borg_pip_packages }}"
 | 
			
		||||
 | 
			
		||||
@ -5,10 +5,16 @@ borg_dep_packages:
 | 
			
		||||
borg_cron_package: cronie
 | 
			
		||||
 | 
			
		||||
borg_pip_packages:
 | 
			
		||||
  - acl
 | 
			
		||||
  - gcc
 | 
			
		||||
  - lz4
 | 
			
		||||
  - openssl
 | 
			
		||||
  - pkgconfig
 | 
			
		||||
  - python-pip
 | 
			
		||||
  - python-setuptools
 | 
			
		||||
  - xxhash
 | 
			
		||||
  - xz
 | 
			
		||||
  - zstd
 | 
			
		||||
 | 
			
		||||
borg_distro_packages:
 | 
			
		||||
  - borg
 | 
			
		||||
 | 
			
		||||
@ -5,17 +5,22 @@ borg_dep_packages:
 | 
			
		||||
borg_cron_package: cronie
 | 
			
		||||
 | 
			
		||||
borg_pip_packages:
 | 
			
		||||
  - libacl-devel
 | 
			
		||||
  - libacl
 | 
			
		||||
  - gcc
 | 
			
		||||
  - gcc-c++
 | 
			
		||||
  - libacl
 | 
			
		||||
  - libacl-devel
 | 
			
		||||
  - libzstd-devel
 | 
			
		||||
  - lz4-devel
 | 
			
		||||
  - openssl-devel
 | 
			
		||||
  - python3-pip
 | 
			
		||||
  - python3-wheel
 | 
			
		||||
  - openssl-devel
 | 
			
		||||
  - python3-cython
 | 
			
		||||
  - python3-devel
 | 
			
		||||
  - python3-pip
 | 
			
		||||
  - python3-setuptools
 | 
			
		||||
  - python3-Cython
 | 
			
		||||
 | 
			
		||||
  - python3-wheel
 | 
			
		||||
  - xxhash
 | 
			
		||||
  - xxhash-devel
 | 
			
		||||
  
 | 
			
		||||
borg_distro_packages:
 | 
			
		||||
  - borgbackup
 | 
			
		||||
  - borgmatic
 | 
			
		||||
 | 
			
		||||
@ -5,16 +5,20 @@ borg_dep_packages:
 | 
			
		||||
borg_cron_package: cronie
 | 
			
		||||
 | 
			
		||||
borg_pip_packages:
 | 
			
		||||
  - libacl-devel
 | 
			
		||||
  - libacl
 | 
			
		||||
  - gcc
 | 
			
		||||
  - gcc-c++
 | 
			
		||||
  - libacl
 | 
			
		||||
  - libacl-devel
 | 
			
		||||
  - libzstd-devel
 | 
			
		||||
  - lz4-devel
 | 
			
		||||
  - openssl-devel
 | 
			
		||||
  - python3-pip
 | 
			
		||||
  # - python3-wheel
 | 
			
		||||
  - python3-devel
 | 
			
		||||
  - python3-pip
 | 
			
		||||
  - python3-setuptools
 | 
			
		||||
  - xxhash
 | 
			
		||||
  - xxhash-devel
 | 
			
		||||
  # - python3-virtualenv
 | 
			
		||||
  # - python3-wheel
 | 
			
		||||
 | 
			
		||||
borg_distro_packages:
 | 
			
		||||
  - borgbackup
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user