From 7efeb1be5ef49ea66a4f27498f383d5183970b2b Mon Sep 17 00:00:00 2001 From: Sam Hartsfield Date: Wed, 19 Apr 2023 06:07:29 -0400 Subject: [PATCH] Fix failing on EPEL check in Fedora (#111) * Fix failing on EPEL check in Fedora Only applies when using the "package" install method. Added a separate variable "borg_require_epel" to make it easy to disable the check in any other situations (e.g. using a custom mirror instead of the epel-release package). * Explain default value of borg_require_epel --- README.md | 1 + defaults/main.yml | 1 + tasks/noauto_install_package.yml | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index db8f434..189a06d 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,7 @@ $ git clone https://github.com/borgbase/ansible-role-borgbackup.git roles/ansibl - `borg_exclude_from`: Read exclude patterns from one or more separate named files, one pattern per line. - `borg_exclude_patterns`: Paths or patterns to exclude from backup. See [official documentation](https://borgbackup.readthedocs.io/en/stable/usage/help.html#borg-help-patterns) for more. - `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_require_epel`: When using `borg_install_method: package` on RHEL-based distributions, the EPEL repo is required. To disable the check (e.g. when using a custom mirror instead of the `epel-release` package), set this to `false`. Defaults to `{{ ansible_os_family == 'RedHat' and ansible_distribution != 'Fedora' }}` (i.e. `true` on Enterprise Linux-based distros). - `borg_lock_wait_time`: Config maximum seconds to wait for acquiring a repository/cache lock. Defaults to 5 seconds. - `borg_one_file_system`: Don't cross file-system boundaries. Defaults to `true` - `borg_pip_packages`: Dependancy Packages (pip) to install `borg(backup)` and `borgmatic`. diff --git a/defaults/main.yml b/defaults/main.yml index 4dd9630..c3c0788 100755 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -22,6 +22,7 @@ borgmatic_timer: cron borgmatic_timer_hour: "{{ range(0, 5) | random(seed=inventory_hostname) }}" borgmatic_timer_minute: "{{ range(0, 59) | random(seed=inventory_hostname) }}" borg_install_method: "pip" +borg_require_epel: "{{ ansible_os_family == 'RedHat' and ansible_distribution != 'Fedora' }}" borgmatic_config_name: config.yaml borgmatic_hooks: diff --git a/tasks/noauto_install_package.yml b/tasks/noauto_install_package.yml index d07e30b..5f28a58 100644 --- a/tasks/noauto_install_package.yml +++ b/tasks/noauto_install_package.yml @@ -2,7 +2,7 @@ - name: Install borgbackup by distro block: - name: Check if EPEL repo is enabled, if installation from distro is requested - when: ansible_os_family == 'RedHat' + when: borg_require_epel block: - name: Get list of installed packages ansible.builtin.package_facts: