diff --git a/galaxy.yml b/galaxy.yml index 27a4c05..27d6c78 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -1,7 +1,7 @@ --- namespace: stackhpc name: openstack -version: 0.5.2 +version: 0.5.3 readme: README.md authors: - StackHPC Ltd @@ -13,6 +13,7 @@ tags: - openstack dependencies: "openstack.cloud": ">=2.1.0" + "community.general": ">=8.2.0" repository: https://github.com/stackhpc/ansible-collection-openstack documentation: https://github.com/stackhpc/ansible-collection-openstack/blob/main/README.md homepage: https://github.com/stackhpc/ansible-collection-openstack diff --git a/roles/os_images/README.md b/roles/os_images/README.md index 1bf08cf..1f956f0 100644 --- a/roles/os_images/README.md +++ b/roles/os_images/README.md @@ -25,6 +25,10 @@ Role Variables `os_images_package_dependencies_extra`: List of additional packages to install on the build host. +`os_images_install_epel_repo`: Whether to enable the CRB repository and install +the EPEL repository before installing packages on the build host. This is +disabled by default. + `os_images_cache`: a path to a directory in which to cache build artefacts. It defaults to `~/disk_images` `NOTE`: new images will NOT be built, even if changes are made in config, if an image diff --git a/roles/os_images/defaults/main.yml b/roles/os_images/defaults/main.yml index 41e5e54..01ec5ac 100644 --- a/roles/os_images/defaults/main.yml +++ b/roles/os_images/defaults/main.yml @@ -1,6 +1,9 @@ --- # List of additional host package dependencies to install. os_images_package_dependencies_extra: [] +# Whether to enable the CRB repository and install the EPEL repository before +# installing packages. +os_images_install_epel_repo: false # Path to virtualenv in which to install python dependencies to upload images. os_images_venv: # Path to virtualenv in which to install DIB to build images. diff --git a/roles/os_images/tasks/prereqs.yml b/roles/os_images/tasks/prereqs.yml index 4d75345..77de1d7 100644 --- a/roles/os_images/tasks/prereqs.yml +++ b/roles/os_images/tasks/prereqs.yml @@ -2,6 +2,24 @@ - name: Include OS family-specific variables ansible.builtin.include_vars: "{{ ansible_facts.os_family }}.yml" +- name: Ensure CRB repository is enabled + community.general.dnf_config_manager: + name: crb + state: enabled + when: + - os_images_install_epel_repo | bool + - ansible_facts.os_family == "RedHat" + become: true + +- name: Ensure EPEL repository is installed + ansible.builtin.dnf: + name: epel-release + state: present + when: + - os_images_install_epel_repo | bool + - ansible_facts.os_family == "RedHat" + become: true + - name: Ensure required packages are installed ansible.builtin.package: name: "{{ (os_images_package_dependencies + os_images_package_dependencies_extra) | select | list }}"