Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

infra.aap_utilities.aap_setup_prepare doesn't generate proper inventory if the group names don't match with keys in aap_setup_prep_inv_nodes variable #258

Open
snagoor opened this issue Oct 20, 2024 · 0 comments · May be fixed by #259
Labels
bug Something isn't working new

Comments

@snagoor
Copy link
Contributor

snagoor commented Oct 20, 2024

Summary

infra.aap_utilities.aap_setup_prepare doesn't generate proper inventory if the group names don't match with keys in aap_setup_prep_inv_nodes variable

Issue Type

  • Bug Report

Ansible, Collection, Docker/Podman details

ansible --version
ansible [core 2.15.3]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.9/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.9.16 (main, May 29 2023, 00:00:00) [GCC 11.3.1 20221121 (Red Hat 11.3.1-4)] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True

ansible-galaxy collection list
# /root/.ansible/collections/ansible_collections
Collection                                Version
----------------------------------------- -------
ansible.controller                        4.4.0  
ansible.posix                             1.5.4  
awx.awx                                   24.6.1 
community.crypto                          2.22.1 
community.general                         9.5.0  
infra.aap_utilities                       2.5.2  
kubernetes.core                           2.4.0  
middleware_automation.common              1.1.2  
middleware_automation.keycloak            1.2.7  
middleware_automation.redhat_csp_download 1.2.2  
nshaik.aap_collection                     1.0.18 
redhat.satellite                          3.12.0 

podman --version
podman version 4.4.1
  • ansible installation method: one of source, pip, OS package, EE

OS / ENVIRONMENT

Desired Behavior

When we map our ansible host groups to the default group names that is expected in aap_setup_prep_inv_nodes variable then the inventory ini file should be created with proper setup.

End-user should be given the flexibility of choosing the group names as they wish to be mapped with groups that the installer expects.

Actual Behavior

Please give some details of what is actually happening.

When we group hosts based on a different name other than default group names that is expected in aap_setup_prep_inv_nodes variable then the inventory ini file created will have empty groups
Include a minimum complete verifiable example with:

  • playbook / task
For example, create an inventory with the following (in reality we can dynamically group hosts while provisioning in an end-to-end automation)
[controller]
ctrl1.example.com
ctrl2.example.com
ctrl3.example.com

[db]
db.example.com

And then define the playbook variables expected in infra.aap_utilities.aap_setup_prepare role

---
### Variables for AAP2 setup ###
aap_setup_down_offline_token: "{{ aap_offline_token }}"
aap_setup_down_version: "{{ aap_version }}"
aap_setup_down_type: "setup"
aap_setup_rhel_version: "{{ rhel_version }}"
aap_setup_prep_inv_nodes:
  automationcontroller: "{{ groups['controller'] }}"
  database: "{{ groups[db] }}"
aap_setup_prep_inv_vars:
  automationcontroller:
    node_type: hybrid
    ignore_preflight_errors: true
  database:
    ignore_preflight_errors: true
  all:
    pg_database: "awx"
    pg_username: "awx"
    pg_sslmode: "prefer"
    receptor_listener_port: 27199
aap_setup_prep_inv_secrets:
  all:
    registry_url: "registry.redhat.io"
    registry_username: "{{ registry_username }}"
    registry_password: "{{ registry_password }}"
    admin_password: "{{ admin_password }}"
    pg_password: "{{ pg_password }}"
controller_hostname: "{{ groups['controller'][0] }}"
controller_validate_certs: false
  • configuration file / list
  • error

No actual groups are created.

[automationcontroller:vars]
node_type=hybrid
ignore_preflight_errors=True

STEPS TO REPRODUCE

This is happening due to this PR 8363732.

It strictly enforces that the user provided group name should match with the group names under aap_setup_prep_inv_nodes variable.

I understand that the latest 2.5.2 release of infra.aap_utilities collection still doesn't have this code. This error is reproduceable only when above mentioned PR is included.

@snagoor snagoor added bug Something isn't working new labels Oct 20, 2024
@snagoor snagoor linked a pull request Oct 20, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working new
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant