controller_projects.yml

In these files we configure the projects for the organization in automation controller.
We will probably do some of these on each environment separately, as the hostnames differ.

The infra.aap_configuration collection expects the vaules in the variable: controller_projects. 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 projects 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_projects.yml

Here we configure only recovery scenarios in the base configuration, so we can restore eveything after initial configuration.

---
controller_projects_all:

  - name: ORG_NEW_inventory
    description: 
    organization: ORG_NEW
    scm_type: git
    scm_url: git@gitlab.homelab:org_new_group/inventory.git
    scm_credential: ORG_NEW_gitlab_acc
    scm_branch: master
    scm_clean: false
    scm_delete_on_update: false
    scm_update_on_launch: true
    scm_update_cache_timeout: 0
    allow_override: false
    timeout: 0

  - name: ORG_NEW_project_1
    description: Just a project
    organization: ORG_NEW
    scm_type: git
    scm_url: git@gitlab.homelab:org_new_group/project_1.git
    scm_credential: ORG_NEW_gitlab_acc
    scm_branch: master
    scm_clean: false
    scm_delete_on_update: false
    scm_update_on_launch: true
    scm_update_cache_timeout: 0
    allow_override: false
    timeout: 0
...

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_projects.yml

We configure some extra projects in development, but these are inventory projects with base variables for constructed inventories we use.

---
controller_projects_dev:

  - name: ORG_NEW_project_2
    description: Just a second project
    organization: ORG_NEW
    scm_type: git
    scm_url: git@gitlab.homelab:org_new_group/project_2.git
    scm_credential: ORG_NEW_gitlab_acc
    scm_branch: master
    scm_clean: false
    scm_delete_on_update: false
    scm_update_on_launch: true
    scm_update_cache_timeout: 0
    allow_override: false
    timeout: 0

  - name: ORG_NEW_project_3
    description: Just a third project
    organization: ORG_NEW
    scm_type: git
    scm_url: git@gitlab.homelab:org_new_group/project_3.git
    scm_credential: ORG_NEW_gitlab_acc
    scm_branch: master
    scm_clean: false
    scm_delete_on_update: false
    scm_update_on_launch: true
    scm_update_cache_timeout: 0
    allow_override: false
    timeout: 0
...

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

group_vars/prod/controller_projects.yml

We configure some extra projects in production, but these are inventory projects with base variables for constructed inventories we use.

---
controller_projects_prod:

  - name: ORG_NEW_project_4
    description: May the fourth be with you
    organization: ORG_NEW
    scm_type: git
    scm_url: git@gitlab.homelab:org_new_group/project_4.git
    scm_credential: ORG_NEW_gitlab_acc
    scm_branch: master
    scm_clean: false
    scm_delete_on_update: false
    scm_update_on_launch: true
    scm_update_cache_timeout: 0
    allow_override: false
    timeout: 0

  - name: ORG_NEW_project_5
    description: Number 5 is alive
    organization: ORG_NEW
    scm_type: git
    scm_url: git@gitlab.homelab:org_new_group/project_5.git
    scm_credential: ORG_NEW_gitlab_acc
    scm_branch: master
    scm_clean: false
    scm_delete_on_update: false
    scm_update_on_launch: true
    scm_update_cache_timeout: 0
    allow_override: false
    timeout: 0
...

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_projects_all
- controller_projects_

We will merge these 2 variables into 1: controller_projects and feed this to the infra.aap_configuration.controller_projects role.

Back