aap_organizations
In this file, we configure all organizations(teams) that need access to the automation platform.
Only the organization(team) name and description are configured.
An id is dynamicly assigned to the organization.
The infra.aap_configuration collection expects the vaules in the variable: aap_organizations.
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.
group_vars/all/aap_organizations.yml
---
aap_organizations_all:
- name: MGT
description: 'Automation platform management'
...
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/aap_organizations.yml
As we do not configure extra organizations in rhaap, this file is an empty set.
---
aap_organizations_dev: []
# No extra config exists
...
Here the variable has the "_dev" extension, so the variable will not be overridden.
group_vars/prod/aap_organizations.yml
As we do not configure extra organizations in rhaap, this file is an empty set.
---
aap_organizations_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_organizations_all
- gateway_organizations_
We will merge these 2 variables into 1: aap_organizations and feed this to the infra.aap_configuration.gateway_organizations 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:
aap_organizations: >
{{ aap_organizations_all |
community.general.lists_mergeby(vars['aap_organizations_' + branch_name],
'name', recursive=true, list_merge='append') }}
This results in the aap_organizations variable the collection needs.