controller_license.yml

In these files we configure the license for automation controller.
we will probably do this on each environment separately, as the subscription may be different.

variables

The api understands the following structure for defining license in controller:

{
    "manifest_file": ""
}

group_vars/all/controller_license.yml

Here we see an empty dict for all.

---
controller_license_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_license.yml

As we do not configure extra license in development, this file is an empty set.
(We use the containerized setup version, so no need for license).

---
controller_license_dev:
  manifest_file: /tmp/manifest_rhaap.zip
...

Here the variable has the "_dev" extension, so the variable will not be overridden.

group_vars/prod/controller_license.yml

As we do not configure extra license in prod, this file is an empty set.

---
controller_license_prod:
  manifest_file: /tmp/manifest_rhaap.zip
...

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_license_all
- controller_license_

We will merge these 2 variables into 1: controller_license and feed this to the infra.aap_configuration.controller_license role.
In main.yml the merge of the variables is done by this piece of code:

    - name: Set the controller vars
      ansible.builtin.set_fact:
        controller_license: >
          {{ controller_license_all |
          community.general.lists_mergeby(vars['controller_license_' + branch_name],
          'name', recursive=true, list_merge='append') }}

This results in the controller_license variable the collection needs.

Back