main.yml.j2
This is the main.yml template to replace the original main.yml in the repository.
It will add some extra features to the main.yml:
- create the variables needed for eda configuration
- stop running rulebooks for this organization, prior to configuration
---
- name: Configure rhaap platform controller for MGT
hosts: "{{ instance | default('localhost') }}"
connection: local
gather_facts: false
pre_tasks:
- name: Get rhaap secrets from vault
community.hashi_vault.vault_kv2_get:
url: 'http://<vault-fqdn>:<vault-port>'
token: "{{ vault_token }}"
namespace: "{{ branch_name }}/{{ org_name }}"
engine_mount_point: kv
path: "rhaap_admin"
register: secrets
no_log: true
- name: Set rhaap configuration facts
ansible.builtin.set_fact:
aap_hostname: "{{ secrets['secret']['hostname'] }}"
aap_username: "{{ secrets['secret']['username'] }}"
aap_password: "{{ secrets['secret']['password'] }}"
aap_validate_certs: "{{ secrets['secret']['validate_certs'] }}"
no_log: true
- name: Set the vars
ansible.builtin.set_fact:
aap_configuration_secure_logging: false
- name: Find var files for controller and eda
ansible.builtin.find:
paths: "group_vars/{{ branch_name }}"
patterns:
- 'controller_*.yml'
- 'eda_*.yml'
register: _ctl_files
- name: Create the vaiables for configuration as code
ansible.builtin.set_fact:
"{{ ((filectlr.path | split('/'))[2] | split('.'))[0] }}": |
{{ vars[(((filectlr.path | split('/'))[2] | split('.'))[0]) + '_all'] | list +
vars[(((filectlr.path | split('/'))[2] | split('.'))[0]) + '_' + branch_name] | list }}
loop: "{{ _ctl_files.files }}"
loop_control:
loop_var: filectlr
label: "{{ filectlr.path }}"
- name: Do fixups for activation rulebooks if needed
ansible.builtin.include_tasks: stop_running_rulebooks.yml
roles:
- infra.aap_configuration.dispatch