gateway_http_ports
The infra.aap_configuration collection expects the vaules in the variable: gateway_http_ports.
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 http_ports 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/gateway_http_ports.yml
As we do not configure extra http_ports, this file should be an empty set.
As we could allocate http_ports for a new application, we show the configuration.
---
gateway_http_ports_all:
- name: "Controller config port"
number: 8001
use_https: true
- name: "Automation hub config port"
number: 8002
use_https: true
- name: "EDA config port"
number: 8003
use_https: true
But you can already see that the variable name used here has the "_all" extension, so the variable will not be overridden as this is not quite a inventory.
Why we do this, will become clear in a moment.
group_vars/dev/gateway_http_ports.yml
As we do not configure extra application in rhaap, this file is an empty set.
---
gateway_http_ports_dev: []
# No extra config exists
...
Here the variable has the "_dev" extension, so the variable will not be overridden.
group_vars/prod/gateway_http_ports.yml
As we do not configure extra application in rhaap, this file is an empty set.
---
gateway_http_ports_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:
- gateway_http_ports_all
- gateway_http_ports_
We will merge these 2 variables into 1: gateway_http_ports and feed this to the infra.aap_configuration.gateway_http_ports 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:
gateway_http_ports: >
{{ gateway_http_ports_all |
community.general.lists_mergeby(vars['gateway_http_ports_' + branch_name],
'name', recursive=true, list_merge='append') }}
This results in the gateway_http_ports variable the collection needs.