use backports on debian 11 for package install

This commit is contained in:
Dirk Sarpe 2023-05-26 11:50:50 +02:00
parent f5d7a0afb6
commit 9a77705f28
2 changed files with 10 additions and 1 deletions

View File

@ -23,6 +23,7 @@ borgmatic_timer_hour: "{{ range(0, 5) | random(seed=inventory_hostname) }}"
borgmatic_timer_minute: "{{ range(0, 59) | random(seed=inventory_hostname) }}" borgmatic_timer_minute: "{{ range(0, 59) | random(seed=inventory_hostname) }}"
borg_install_method: "pip" borg_install_method: "pip"
borg_require_epel: "{{ ansible_os_family == 'RedHat' and ansible_distribution != 'Fedora' }}" borg_require_epel: "{{ ansible_os_family == 'RedHat' and ansible_distribution != 'Fedora' }}"
borg_require_backports: "{{ ansible_distribution == 'Debian' and ansible_distribution_major_version == '11' }}"
borgmatic_config_name: config.yaml borgmatic_config_name: config.yaml
borgmatic_hooks: borgmatic_hooks:

View File

@ -13,9 +13,17 @@
- "'epel-release' in ansible_facts.packages" - "'epel-release' in ansible_facts.packages"
fail_msg: Need EPEL repo to install via distro package. 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 - name: Install borgmatic and borg via distribution package manager
ansible.builtin.package: ansible.builtin.package:
name: "{{ item }}" name: "{{ item }}"
state: present state: "{{ __borg_require_backports.changed | ternary('latest', 'present') }}"
default_release: "{{ borg_require_backports | ternary(ansible_distribution_release + '-backports', omit) }}"
loop: "{{ borg_distro_packages }}" loop: "{{ borg_distro_packages }}"
... ...