mirror of
https://github.com/borgbase/ansible-role-borgbackup.git
synced 2024-12-27 00:08:33 +01:00
58 lines
1.7 KiB
YAML
58 lines
1.7 KiB
YAML
---
|
|
- 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 }}"
|
|
state: present
|
|
|
|
- name: Create virtualenv for borg # noqa package-latest
|
|
ansible.builtin.pip:
|
|
name:
|
|
- pip
|
|
- setuptools
|
|
state: latest
|
|
virtualenv: "{{ borg_venv_path }}"
|
|
virtualenv_command: "{{ python_bin }} -m venv"
|
|
|
|
- name: Install dependent Python packages
|
|
ansible.builtin.pip:
|
|
name: "{{ borg_dependent_python_packages }}"
|
|
virtualenv: "{{ borg_venv_path }}"
|
|
when: borg_dependent_python_packages is defined
|
|
|
|
- name: Install main Python packages
|
|
ansible.builtin.pip:
|
|
name: "{{ item.name }}"
|
|
version: "{{ item.version | default(omit, true) }}"
|
|
virtualenv: "{{ borg_venv_path }}"
|
|
when: borg_python_packages is defined
|
|
loop: "{{ borg_python_packages }}"
|
|
|
|
- name: Create links to Borgmatic and Borg binaries
|
|
block:
|
|
- name: Create borgmatic command in /usr/local/bin
|
|
ansible.builtin.copy:
|
|
content: |
|
|
#!/bin/bash
|
|
. "{{ borg_venv_path }}"/bin/activate
|
|
borgmatic "$@"
|
|
dest: /usr/local/bin/borgmatic
|
|
mode: "0755"
|
|
|
|
- name: Create borg command in /usr/local/bin
|
|
ansible.builtin.copy:
|
|
content: |
|
|
#!/bin/bash
|
|
. "{{ borg_venv_path }}"/bin/activate
|
|
borg "$@"
|
|
dest: /usr/local/bin/borg
|
|
mode: "0755"
|
|
...
|