mirror of
https://github.com/borgbase/ansible-role-borgbackup.git
synced 2025-08-02 13:49:37 +02:00
Split dep lists to avoid installing build deps when using distro pkg
This commit is contained in:
parent
ed5db2212f
commit
85d17cfebb
@ -87,8 +87,8 @@ $ git clone https://github.com/borgbase/ansible-role-borgbackup.git roles/ansibl
|
||||
- `ssh_key_file`: Path to a private ssh key file (default is `.ssh/id_ed25519`). It generates a ed25519 key if the file doesn't exist yet.
|
||||
- `borg_version`: Force a specific borg version to be installed
|
||||
- `borgmatic_version`: Force a specific borgmatic version to be installed
|
||||
- `borgmatic_install_method`: By default `pip` is used to install borgmatic. To install via your distributions package manager set this to `package-manager` and overwrite the `borg_packages` variable to contain your distributions package names required to install borgmatic. Note that many distributions ship outdated versions of borgbackup and borgmatic; use at your own risk.
|
||||
- `borg_system_packages`: contains the names of distributions packages for `borg(backup)` and `borgmatic`, only used if `borgmatic_install_method` is set to `package-manager`.
|
||||
- `borg_install_method`: By default `pip` is used to install borgmatic. To install via your distributions package manager set this to `package` and (if needed) overwrite the `borg_distro_packages` variable to contain your distributions package names required to install borgmatic. Note that many distributions ship outdated versions of borgbackup and borgmatic; use at your own risk.
|
||||
- `borg_distro_packages`: contains the names of distributions packages for `borg(backup)` and `borgmatic`, only used if `borg_install_method` is set to `package`.
|
||||
|
||||
## Contributing
|
||||
|
||||
|
@ -37,4 +37,4 @@ borgmatic_cron_checks_hour: "{{ range(9, 24) | random(seed=inventory_hostname) }
|
||||
borgmatic_cron_checks_minute: "{{ 59 | random(seed=inventory_hostname) }}"
|
||||
borg_version: false
|
||||
borgmatic_version: false
|
||||
borgmatic_install_method: pip
|
||||
borg_install_method: pip
|
||||
|
@ -14,10 +14,10 @@ ENV {{ var }} {{ value }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python3 sudo bash ca-certificates iproute2 python3-apt aptitude && apt-get clean; \
|
||||
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python3 python3-pip sudo bash ca-certificates iproute2 python3-apt aptitude && apt-get clean; \
|
||||
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install /usr/bin/python3 /usr/bin/python3-config /usr/bin/dnf-3 sudo bash iproute && dnf clean all; \
|
||||
elif [ $(command -v yum) ]; then yum makecache fast && yum install -y /usr/bin/python /usr/bin/python2-config sudo yum-plugin-ovl bash iproute && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
|
||||
elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml iproute2 && zypper clean -a; \
|
||||
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
|
||||
elif [ $(command -v pacman) ]; then pacman --noconfirm -Suy python sudo openssh; \
|
||||
elif [ $(command -v pacman) ]; then pacman --noconfirm -Suy python python-pip sudo openssh; \
|
||||
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates iproute2 && xbps-remove -O; fi
|
||||
|
@ -38,6 +38,7 @@
|
||||
- name: users
|
||||
hostname: database1.example.org
|
||||
port: 5433
|
||||
borg_install_method: pip
|
||||
|
||||
post_tasks:
|
||||
- name: Install yamllint for checking config file
|
||||
|
@ -1 +0,0 @@
|
||||
---
|
@ -1 +0,0 @@
|
||||
---
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
- name: Check if EPEL repo is enabled, if installation from distro is requested
|
||||
when: borgmatic_install_method == 'package-manager'
|
||||
when: ansible_os_family == 'RedHat'
|
||||
block:
|
||||
- name: Get list of installed packages
|
||||
ansible.builtin.package_facts:
|
||||
@ -10,3 +10,9 @@
|
||||
that:
|
||||
- "'epel-release' in ansible_facts.packages"
|
||||
fail_msg: Need EPEL repo to install via distro package.
|
||||
|
||||
- name: Install borgmatic and borg via distribution package manager
|
||||
package:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
loop: "{{ borg_distro_packages }}"
|
@ -1,4 +1,9 @@
|
||||
---
|
||||
- name: Install build dependencies
|
||||
package:
|
||||
name: "{{ borg_pip_packages }}"
|
||||
state: present
|
||||
|
||||
- name: Create virtualenv for borg # noqa package-latest
|
||||
pip:
|
||||
name:
|
||||
|
@ -1,6 +0,0 @@
|
||||
---
|
||||
- name: Install borgmatic and borg via distribution package manager
|
||||
package:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
loop: "{{ borg_system_packages }}"
|
@ -16,26 +16,14 @@
|
||||
- "{{ ansible_os_family }}.yml"
|
||||
- "{{ ansible_lsb.id }}.yml"
|
||||
|
||||
- name: Run OS-specific tasks
|
||||
include_tasks: "{{ item }}"
|
||||
with_first_found:
|
||||
- "{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.yml"
|
||||
- "{{ ansible_os_family }}.yml"
|
||||
|
||||
- name: Install required System Packages
|
||||
- name: Install general dependencies (cron and openssh)
|
||||
package:
|
||||
name: "{{ borg_packages }}"
|
||||
name: "{{ borg_dep_packages }}"
|
||||
state: present
|
||||
|
||||
- name: Install borgmatic via pip
|
||||
- name: Install Borg and Borgmatic
|
||||
ansible.builtin.include_tasks:
|
||||
file: install_pip.yml
|
||||
when: borgmatic_install_method == 'pip'
|
||||
|
||||
- name: Install borgmatic via distribution package manager
|
||||
ansible.builtin.include_tasks:
|
||||
file: install_pkg.yml
|
||||
when: borgmatic_install_method == 'package-manager'
|
||||
file: install_{{ borg_install_method }}.yml
|
||||
|
||||
- name: Ensure root has SSH key.
|
||||
user:
|
||||
|
@ -1,13 +1,15 @@
|
||||
---
|
||||
borg_packages:
|
||||
borg_dep_packages:
|
||||
- cronie
|
||||
- gcc
|
||||
- openssh
|
||||
|
||||
borg_pip_packages:
|
||||
- gcc
|
||||
- pkgconfig
|
||||
- python-pip
|
||||
- python-setuptools
|
||||
|
||||
borg_system_packages:
|
||||
borg_distro_packages:
|
||||
- borg
|
||||
- borgmatic
|
||||
|
||||
|
@ -1,5 +1,9 @@
|
||||
---
|
||||
borg_packages:
|
||||
borg_dep_packages:
|
||||
- openssh-client
|
||||
- cron
|
||||
|
||||
borg_pip_packages:
|
||||
- libssl-dev
|
||||
- libacl1-dev
|
||||
- libacl1
|
||||
@ -10,10 +14,8 @@ borg_packages:
|
||||
- python3-pkgconfig
|
||||
- python3-msgpack
|
||||
- python3-venv
|
||||
- openssh-client
|
||||
- cron
|
||||
|
||||
borg_system_packages:
|
||||
borg_distro_packages:
|
||||
- borgbackup
|
||||
- borgmatic
|
||||
|
||||
|
@ -1,5 +1,9 @@
|
||||
---
|
||||
borg_packages:
|
||||
borg_dep_packages:
|
||||
- cronie
|
||||
- openssh-clients
|
||||
|
||||
borg_pip_packages:
|
||||
- libacl-devel
|
||||
- libacl
|
||||
- gcc
|
||||
@ -10,10 +14,8 @@ borg_packages:
|
||||
- python3-devel
|
||||
- python3-setuptools
|
||||
- python3-Cython
|
||||
- openssh-clients
|
||||
- cronie
|
||||
|
||||
borg_system_packages:
|
||||
borg_distro_packages:
|
||||
- borgbackup
|
||||
- borgmatic
|
||||
|
||||
|
@ -1,10 +1,21 @@
|
||||
---
|
||||
borg_packages:
|
||||
- borgmatic
|
||||
borg_dep_packages:
|
||||
- openssh
|
||||
- cronie
|
||||
|
||||
borg_system_packages:
|
||||
borg_pip_packages: # untested
|
||||
- libssl-dev
|
||||
- libacl1-dev
|
||||
- libacl1
|
||||
- build-essential
|
||||
- python3-setuptools
|
||||
- python3-dev
|
||||
- python3-pip
|
||||
- python3-pkgconfig
|
||||
- python3-msgpack
|
||||
- python3-venv
|
||||
|
||||
borg_distro_packages:
|
||||
- borg
|
||||
- borgmatic
|
||||
|
||||
|
@ -1,5 +1,9 @@
|
||||
---
|
||||
borg_packages:
|
||||
borg_dep_packages:
|
||||
- openssh-clients
|
||||
- cronie
|
||||
|
||||
borg_pip_packages:
|
||||
- libacl-devel
|
||||
- libacl
|
||||
- gcc
|
||||
@ -10,10 +14,8 @@ borg_packages:
|
||||
- python3-devel
|
||||
- python3-setuptools
|
||||
- python3-virtualenv
|
||||
- openssh-clients
|
||||
- cronie
|
||||
|
||||
borg_system_packages:
|
||||
borg_distro_packages:
|
||||
- borgbackup
|
||||
- borgmatic
|
||||
|
||||
|
@ -1,5 +1,9 @@
|
||||
---
|
||||
borg_packages:
|
||||
borg_dep_packages:
|
||||
- cronie
|
||||
- openssh-clients
|
||||
|
||||
borg_pip_packages:
|
||||
- libacl-devel
|
||||
- libacl
|
||||
- gcc
|
||||
@ -10,10 +14,8 @@ borg_packages:
|
||||
- python3-devel
|
||||
- python3-setuptools
|
||||
# - python3-virtualenv
|
||||
- openssh-clients
|
||||
- cronie
|
||||
|
||||
borg_system_packages:
|
||||
borg_distro_packages:
|
||||
- borgbackup
|
||||
- borgmatic
|
||||
|
||||
|
@ -1,5 +1,9 @@
|
||||
---
|
||||
borg_packages:
|
||||
borg_dep_packages:
|
||||
- cronie
|
||||
- openssh-clients
|
||||
|
||||
borg_pip_packages:
|
||||
- libacl-devel
|
||||
- libacl
|
||||
- gcc
|
||||
@ -9,10 +13,8 @@ borg_packages:
|
||||
- python36-wheel
|
||||
- python36-devel
|
||||
- python-setuptools
|
||||
- openssh-clients
|
||||
- cronie
|
||||
|
||||
borg_system_packages:
|
||||
borg_distro_packages:
|
||||
- borgbackup
|
||||
- borgmatic
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
borg_dependent_python_packages:
|
||||
- cython
|
||||
- pkgconfig
|
||||
|
||||
borg_python_packages:
|
||||
- name: borgbackup
|
||||
version: "{{ borg_version }}"
|
||||
|
Loading…
Reference in New Issue
Block a user