controller_hosts.yml
In these files we configure the hosts for automation controller.
we will probably do this on each environment separately, as the hostnames differ.
The infra.aap_configuration collection expects the vaules in the variable: controller_hosts.
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 hosts 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/controller_hosts.yml
Here we see an empty set for all.
---
controller_hosts_all: []
...
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/controller_hosts.yml
As we do not configure extra hosts in development, this file is an empty set.
(We use the containerized setup version, so no need for hosts).
---
controller_hosts_dev: []
# No extra config exists
...
Here the variable has the "_dev" extension, so the variable will not be overridden.
group_vars/prod/controller_hosts.yml
As we do not configure extra hosts in prod, this file is an empty set.
---
controller_hosts_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:
- controller_hosts_all
- controller_hosts_
We will merge these 2 variables into 1: controller_hosts and feed this to the infra.aap_configuration.controller_hosts role.