Skip to content

Commit 1776d5c

Browse files
committed
Add option to install EPEL prereq for os_images
1 parent 1d5bade commit 1776d5c

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

roles/os_images/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ Role Variables
2525
`os_images_package_dependencies_extra`: List of additional packages to install
2626
on the build host.
2727

28+
`os_images_install_epel_repo`: Whether to enable the CRB repository and install
29+
the EPEL repository before installing packages on the build host. This is
30+
disabled by default to prevent conflicts arising from the EPEL repository.
31+
2832
`os_images_cache`: a path to a directory in which to cache build artefacts.
2933
It defaults to `~/disk_images`
3034
`NOTE`: new images will NOT be built, even if changes are made in config, if an image

roles/os_images/defaults/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
---
22
# List of additional host package dependencies to install.
33
os_images_package_dependencies_extra: []
4+
# Whether to enable the CRB repository and install the EPEL repository before
5+
# installing packages.
6+
os_images_install_epel_repo: false
47
# Path to virtualenv in which to install python dependencies to upload images.
58
os_images_venv:
69
# Path to virtualenv in which to install DIB to build images.

roles/os_images/tasks/prereqs.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@
22
- name: Include OS family-specific variables
33
ansible.builtin.include_vars: "{{ ansible_facts.os_family }}.yml"
44

5+
- name: Ensure CRB repository is enabled
6+
community.general.dnf_config_manager:
7+
name: crb
8+
state: enabled
9+
when:
10+
- os_images_install_epel_repo | bool
11+
- ansible_facts.os_family == "RedHat"
12+
become: true
13+
14+
- name: Ensure EPEL repository is installed
15+
ansible.builtin.dnf:
16+
name: epel-release
17+
state: present
18+
when:
19+
- os_images_install_epel_repo | bool
20+
- ansible_facts.os_family == "RedHat"
21+
become: true
22+
523
- name: Ensure required packages are installed
624
ansible.builtin.package:
725
name: "{{ (os_images_package_dependencies + os_images_package_dependencies_extra) | select | list }}"

0 commit comments

Comments
 (0)