ansible-role-borgbackup/tasks/noauto_install_package.yml
2023-05-26 11:50:50 +02:00

30 lines
1.2 KiB
YAML

---
- name: Install borgbackup by distro
block:
- name: Check if EPEL repo is enabled, if installation from distro is requested
when: borg_require_epel
block:
- name: Get list of installed packages
ansible.builtin.package_facts:
manager: auto
- name: Ensure EPEL is enabled
ansible.builtin.assert:
that:
- "'epel-release' in ansible_facts.packages"
fail_msg: Need EPEL repo to install via distro package.
- name: Check if backports repo is enabled, if installation from distro is requested
when: borg_require_backports
ansible.builtin.apt_repository:
repo: "deb http://deb.debian.org/debian {{ ansible_distribution_release }}-backports main"
state: present
register: __borg_require_backports
- name: Install borgmatic and borg via distribution package manager
ansible.builtin.package:
name: "{{ item }}"
state: "{{ __borg_require_backports.changed | ternary('latest', 'present') }}"
default_release: "{{ borg_require_backports | ternary(ansible_distribution_release + '-backports', omit) }}"
loop: "{{ borg_distro_packages }}"
...