hub_collection_repositories
Ensure the correct repositories are availlable to load collections into.
Ensure that you have a repository you can controll yourself, by adding the 'custom' repository.
Define it in the correct way, otherwise your users cannot download the uploaded collections.
NOTE The add repository without remote is broken in version 4.4.0 of the collection, a bug has been logged (#1359) to have this fixed.
The execution will stop on a (http:500 internal server error from automation hub).
For now there is only the option to add the repository by hand.
The infra.aap_configuration collection expects the vaules in the variable: hub_collection_repositories.
As we intend to configure everything just once, we spit the set of vars into the environments and join the lists in the main.yml, before calling the collection.
If there are no collection_repositories defined, do not add this file.
If you do, ensure the file is present in all branches, with the correct content, described below.
group_vars/all/hub_collection_repositories.yml
Just to be sure, we add the default repositories here.
---
hub_collection_repositories_all:
- name: rh-certified
description: Red Hat certified content repository
remote: rh-certified
update_repo: true
wait: false
state: present
- name: community
description: Community content repository
remote: community
update_repo: true
wait: false
state: present
- name: validated
description: Redhat validated content repository
remote: validated
update_repo: true
wait: false
state: present
# - name: custom
# description: Custom collection content repository
# update: false
# pulp_labels:
# pipeline: approved
# distribution:
# name: custom
# state: present
...
The definition above will ensure that the 'custom' repository will be useable by your users.
group_vars/dev/hub_collection_repositories.yml
As we do not configure extra repositories in automation hub, this file is an empty set.
---
hub_collection_repositories_dev: []
# No extra config exists
...
Here the variable has the "_dev" extension, so the variable will not be overridden.
group_vars/prod/hub_collection_repositories.yml
As we do not configure extra repositories in automation hub, this file is an empty set.
---
hub_collection_repositories_prod: []
# No extra config exists
...
Here the variable has the "_prod" extension, so the variable will not be overridden.
When we run a pipeline for a certain environment, the inventory structure will provide us with 2 variables:
- hub_collection_repositories_all
- hub_collection_repositories_
We will merge these 2 variables into 1: hub_collection_repositories and feed this to the infra.aap_configuration.hub_collection_repositories role.
In main.yml the merge of the variables is done by this piece of code:
- name: Set the gateway vars
ansible.builtin.set_fact:
hub_collection_repositories: >
{{ hub_collection_repositories_all |
community.general.lists_mergeby(vars['hub_collection_repositories_' + branch_name],
'name', recursive=true, list_merge='append') }}
This results in the hub_collection_repositories variable the collection needs.