redhat-cop / aap_utilities

Ansible Collection for automated deployment of AAP and other objects for general use

Home Page:https://galaxy.ansible.com/infra/aap_utilities

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

aap_setup_install assumes dictionaries in aap_setup_prep_inv_nodes var

jon4hz opened this issue · comments

commented

Hi, quick follow up to #192 because I figured out what caused my issue.

controller_hostname: "{{ (aap_setup_prep_inv_nodes['automationcontroller'].keys() | list)[0] }}"

This should probably be something like {{ aap_setup_prep_inv_nodes['automationcontroller'] | first }}. Same goes for ah_hostname and eda_hostname - or you keep the role as it is and adjust the example in the readme :)

Can you point to me where in the documentation it shows dicts, as we would need to change that, I've looked at the aap setup install, download, and prep, and I see lists used in the examples. Its never meant to be a dict. ever.

Like this:
https://github.com/redhat-cop/aap_utilities/tree/devel/roles/aap_setup_prepare#example-inventory-variables

commented

It doesn't show dicts in any documentation. The issue is that the defaults from the aap_setup_install assume dicts.

controller_hostname: "{{ (aap_setup_prep_inv_nodes['automationcontroller'].keys() | list)[0] }}"

ah_hostname: "{{ (aap_setup_prep_inv_nodes['automationhub'].keys() | list)[0] }}"

eda_hostname: "{{ (aap_setup_prep_inv_nodes['automationedacontroller'].keys() | list)[0] }}"

See the code snippets above. You're calling the keys() method on aap_setup_prep_inv_nodes['automationcontroller'] which will throw the error: 'list object' has no attribute 'keys'.

This behavior was introduced by #133 as "fix hostnames".

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.