redhat-cop / aap_utilities

Ansible Collection for automated deployment of AAP and other objects for general use
https://galaxy.ansible.com/infra/aap_utilities
GNU General Public License v3.0
81 stars 50 forks source link

aap_setup_install: Waiting for "eda controller" to be running, #196

Closed nodje closed 9 months ago

nodje commented 1 year ago

using 2.3.0 on latest aap2.4-1.3

This is a minor issue I think:

TASK [infra.aap_utilities.aap_setup_install : Wait for automation hub to be running] *****************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: {{ (aap_setup_prep_inv_nodes['automationedacontroller'].keys() | list)[0] }}: 'list object' has no attribute 'keys'. 'list object' has no attribute 'keys'. {{ (aap_setup_prep_inv_nodes['automationedacontroller'].keys() | list)[0] }}: 'list object' has no attribute 'keys'. 'list object' has no attribute 'keys'\n\nThe error appears to be in '/root/.ansible/collections/ansible_collections/infra/aap_utilities/roles/aap_setup_install/tasks/main.yml': line 111, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n    - name: Wait for automation hub to be running\n      ^ here\n"}

I can't see what keys are missing really, I'm not sure what's different than with AutomationHub task which seats just above in the tasks/main.yml. The name should be fixed but appart from that I don't see what's amiss.

Here the inventory it generated and ran on:

[automationcontroller]
s00vl9993310.fr.net.intra
s00vl9995756.fr.net.intra

[automationedacontroller]
it-automation-eda-test.staging.echonet.net.intra

[database]
s01vl9981311.fr.net.intra

[automationhub]
s01vl9989234.fr.net.intra

[execution_nodes]
s00vl9974130.fr.net.intra
s00vl9974136.fr.net.intra

[instance_group_bastion]
s00vl9974130.fr.net.intra
s00vl9974136.fr.net.intra

[all:vars]
pulp_rhel_codeready_repo=[]
registry_username=admin
registry_password=<>
registry_url=s01vl9989234.fr.net.intra
pg_host=s01vl9981311.fr.net.intra
pg_port='5432'
pg_database=awx
pg_username=awx
pg_sslmode=prefer
automationhub_require_content_approval=True
automationhub_enable_unauthenticated_collection_access=True
automationhub_enable_unauthenticated_collection_download=True
automationhub_pg_host=s01vl9981311.fr.net.intra
automationhub_pg_port='5432'
automationhub_pg_database=automationhub
automationhub_pg_username=automationhub
automationhub_pg_sslmode=prefer
postgres_use_ssl=False
automationedacontroller_pg_host=s01vl9981311.fr.net.intra
automationedacontroller_pg_port='5432'
automationedacontroller_pg_database=automationedacontroller
automationedacontroller_pg_username=automationedacontroller
admin_password=<>
pg_password=<>
automationhub_admin_password=<>
automationhub_pg_password=<>
automationedacontroller_admin_password=<>
automationedacontroller_pg_password=<>
[automationcontroller:vars]
peers=instance_group_bastion
node_type=hybrid
[execution_nodes:vars]
node_type=execution

variables for the setup_prepare:

## prepare inventory
aap_setup_prep_process_template: true
aap_setup_prep_inv_nodes:
  automationcontroller: "{{ groups['automationcontroller'] }}"
  automationedacontroller: "{{ groups['automationedacontroller'] }}"
  database: "{{ groups['database'] | default(omit) }}"
  automationhub: "{{ groups['automationhub'] }}"
  execution_nodes: "{{ groups['execution_nodes'] }}"
  instance_group_bastion: "{{ groups['instance_group_bastion'] }}"
nodje commented 1 year ago

To bring further details, now I'm using an inventory as in the https://github.com/redhat-cop/aap_utilities/tree/devel/roles/aap_setup_install example:

aap_setup_prep_inv_nodes:
  automationcontroller:
    - node1
    - node2
  automationedacontroller:
    eda-test.staging:
  database:
    - db
  automationhub:
    automation.staging:
  execution_nodes:
    - ee1
    - ee2
  instance_group_bastion:
    - ee1
    - ee2

This works. Meaning, AFAIK, contrary to what the example shows at https://github.com/redhat-cop/aap_utilities/tree/devel/roles/aap_setup_install, controller/execution_nodes/database nodes needs to be list while EDA/automationhub need to be dict.

I guess issues come from https://github.com/redhat-cop/aap_utilities/blob/devel/roles/aap_setup_install/defaults/main.yml's eda_hostname and ah_hostname value

djdanielsson commented 11 months ago

interesting, it would probably be best to make them all match if possible

ericzolf commented 9 months ago

They should all be dictionaries and they can all be dictionaries, in order to allow for host variables in the ini files (not the nicest way to do it, but rather common for setup.sh). The truth was and is in aap_setup_prepare: "aap_setup_prep_inv_nodes [...] a dictionary of dictionaries, the first level key is the inventory group name, the 2nd level key is the hostname with the value being its inventory host variables in INI-format".

I'll close both #196 and #197 with a documentation update.