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

gateway_configuration_dispatcher_roles var in dispatch/defaults/main.yml is in wrong order... #1017

Open
hobby65 opened this issue Dec 18, 2024 · 0 comments
Labels
bug Something isn't working new New issue, this should be removed once reviewed

Comments

@hobby65
Copy link

hobby65 commented Dec 18, 2024

Summary

Using aap_configuration.dispatch role on a configuration set of yaml files, specifying a complete configuration of the gateway fails.
The order of the roles the dispatch role calls is incorrect, trying to map roles to users that aren't created yet.

Issue Type

  • Bug Report

Ansible, Collection, Controller details

ansible --version
ansible [core 2.15.10]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/wilco/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/wilco/.local/lib/python3.9/site-packages/ansible
  ansible collection location = /home/wilco/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/wilco/.local/bin/ansible
  python version = 3.9.13 (main, Jul 25 2022, 00:00:00) [GCC 11.3.1 20220421 (Red Hat 11.3.1-2)] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True
[wilco@rhel9-1 ee_cac_image (update)]$ ansible-galaxy collection list

# /home/wilco/.ansible/collections/ansible_collections
Collection                          Version
----------------------------------- -------
ansible.controller                  4.6.3  
ansible.eda                         2.2.0  
ansible.hub                         1.0.0  
ansible.netcommon                   4.1.0  
ansible.platform                    2.5.3  
ansible.posix                       2.0.0  
ansible.utils                       2.8.0  
ansible.windows                     2.6.0  
awx.awx                             22.1.0 
community.crypto                    2.10.0 
community.general                   10.1.0 
community.postgresql                2.3.2  
community.vmware                    5.2.0  
community.windows                   2.3.0  
infra.aap_configuration             3.1.0  
infra.ah_configuration              2.0.4  
redhat.satellite                    4.0.0  
redhat_cop.controller_configuration 2.3.1  
vmware.vmware                       1.7.1  
wf_linux.infra                      0.0.7  
wf_linux.oracle                     0.0.1  
wf_linux.rhel                       0.0.2  
wf_linux.web                        0.0.4  

# /home/wilco/.local/lib/python3.9/site-packages/ansible_collections
Collection                          Version
----------------------------------- -------
amazon.aws                          6.5.0  
ansible.netcommon                   5.3.0  
ansible.posix                       1.5.4  
ansible.utils                       2.12.0 
ansible.windows                     1.14.0 
arista.eos                          6.2.2  
awx.awx                             22.7.0 
azure.azcollection                  1.19.0 
check_point.mgmt                    5.1.1  
chocolatey.chocolatey               1.5.1  
cisco.aci                           2.8.0  
cisco.asa                           4.0.3  
cisco.dnac                          6.9.0  
cisco.intersight                    1.0.27 
cisco.ios                           4.6.1  
cisco.iosxr                         5.0.3  
cisco.ise                           2.6.2  
cisco.meraki                        2.17.0 
cisco.mso                           2.5.0  
cisco.nso                           1.0.3  
cisco.nxos                          4.4.0  
cisco.ucs                           1.10.0 
cloud.common                        2.1.4  
cloudscale_ch.cloud                 2.3.1  
community.aws                       6.4.0  
community.azure                     2.0.0  
community.ciscosmb                  1.0.7  
community.crypto                    2.16.1 
community.digitalocean              1.24.0 
community.dns                       2.6.4  
community.docker                    3.4.11 
community.fortios                   1.0.0  
community.general                   7.5.2  
community.google                    1.0.0  
community.grafana                   1.6.1  
community.hashi_vault               5.0.1  
community.hrobot                    1.8.2  
community.libvirt                   1.3.0  
community.mongodb                   1.6.3  
community.mysql                     3.8.0  
community.network                   5.0.2  
community.okd                       2.3.0  
community.postgresql                2.4.3  
community.proxysql                  1.5.1  
community.rabbitmq                  1.2.3  
community.routeros                  2.11.0 
community.sap                       1.0.0  
community.sap_libs                  1.4.1  
community.skydive                   1.0.0  
community.sops                      1.6.7  
community.vmware                    3.11.1 
community.windows                   1.13.0 
community.zabbix                    2.2.0  
containers.podman                   1.11.0 
cyberark.conjur                     1.2.2  
cyberark.pas                        1.0.23 
dellemc.enterprise_sonic            2.2.0  
dellemc.openmanage                  7.6.1  
dellemc.powerflex                   1.9.0  
dellemc.unity                       1.7.1  
f5networks.f5_modules               1.27.1 
fortinet.fortimanager               2.3.0  
fortinet.fortios                    2.3.4  
frr.frr                             2.0.2  
gluster.gluster                     1.0.2  
google.cloud                        1.3.0  
grafana.grafana                     2.2.3  
hetzner.hcloud                      1.16.0 
hpe.nimble                          1.1.4  
ibm.qradar                          2.1.0  
ibm.spectrum_virtualize             1.12.0 
ibm.storage_virtualize              2.1.0  
infinidat.infinibox                 1.3.12 
infoblox.nios_modules               1.5.0  
inspur.ispim                        1.3.0  
inspur.sm                           2.3.0  
junipernetworks.junos               5.3.1  
kubernetes.core                     2.4.0  
lowlydba.sqlserver                  2.2.2  
microsoft.ad                        1.4.1  
netapp.aws                          21.7.1 
netapp.azure                        21.10.1
netapp.cloudmanager                 21.22.1
netapp.elementsw                    21.7.0 
netapp.ontap                        22.8.3 
netapp.storagegrid                  21.11.1
netapp.um_info                      21.8.1 
netapp_eseries.santricity           1.4.0  
netbox.netbox                       3.15.0 
ngine_io.cloudstack                 2.3.0  
ngine_io.exoscale                   1.1.0  
ngine_io.vultr                      1.1.3  
openstack.cloud                     2.2.0  
openvswitch.openvswitch             2.1.1  
ovirt.ovirt                         3.2.0  
purestorage.flasharray              1.24.0 
purestorage.flashblade              1.14.0 
purestorage.fusion                  1.6.0  
sensu.sensu_go                      1.14.0 
servicenow.servicenow               1.0.6  
splunk.es                           2.1.2  
t_systems_mms.icinga_director       1.33.1 
telekom_mms.icinga_director         1.35.0 
theforeman.foreman                  3.15.0 
vmware.vmware_rest                  2.3.1  
vultr.cloud                         1.11.0 
vyos.vyos                           4.1.0  
wti.remote                          1.0.5  

# /usr/local/lib/python3.9/site-packages/ansible_collections
Collection                          Version
----------------------------------- -------
amazon.aws                          6.5.0  
ansible.netcommon                   5.3.0  
ansible.posix                       1.5.4  
ansible.utils                       2.12.0 
ansible.windows                     1.14.0 
arista.eos                          6.2.2  
awx.awx                             22.7.0 
azure.azcollection                  1.19.0 
check_point.mgmt                    5.1.1  
chocolatey.chocolatey               1.5.1  
cisco.aci                           2.8.0  
cisco.asa                           4.0.3  
cisco.dnac                          6.9.0  
cisco.intersight                    1.0.27 
cisco.ios                           4.6.1  
cisco.iosxr                         5.0.3  
cisco.ise                           2.6.2  
cisco.meraki                        2.17.0 
cisco.mso                           2.5.0  
cisco.nso                           1.0.3  
cisco.nxos                          4.4.0  
cisco.ucs                           1.10.0 
cloud.common                        2.1.4  
cloudscale_ch.cloud                 2.3.1  
community.aws                       6.4.0  
community.azure                     2.0.0  
community.ciscosmb                  1.0.7  
community.crypto                    2.16.1 
community.digitalocean              1.24.0 
community.dns                       2.6.4  
community.docker                    3.4.11 
community.fortios                   1.0.0  
community.general                   7.5.2  
community.google                    1.0.0  
community.grafana                   1.6.1  
community.hashi_vault               5.0.1  
community.hrobot                    1.8.2  
community.libvirt                   1.3.0  
community.mongodb                   1.6.3  
community.mysql                     3.8.0  
community.network                   5.0.2  
community.okd                       2.3.0  
community.postgresql                2.4.3  
community.proxysql                  1.5.1  
community.rabbitmq                  1.2.3  
community.routeros                  2.11.0 
community.sap                       1.0.0  
community.sap_libs                  1.4.1  
community.skydive                   1.0.0  
community.sops                      1.6.7  
community.vmware                    3.11.1 
community.windows                   1.13.0 
community.zabbix                    2.2.0  
containers.podman                   1.11.0 
cyberark.conjur                     1.2.2  
cyberark.pas                        1.0.23 
dellemc.enterprise_sonic            2.2.0  
dellemc.openmanage                  7.6.1  
dellemc.powerflex                   1.9.0  
dellemc.unity                       1.7.1  
f5networks.f5_modules               1.27.1 
fortinet.fortimanager               2.3.0  
fortinet.fortios                    2.3.4  
frr.frr                             2.0.2  
gluster.gluster                     1.0.2  
google.cloud                        1.3.0  
grafana.grafana                     2.2.3  
hetzner.hcloud                      1.16.0 
hpe.nimble                          1.1.4  
ibm.qradar                          2.1.0  
ibm.spectrum_virtualize             1.12.0 
ibm.storage_virtualize              2.1.0  
infinidat.infinibox                 1.3.12 
infoblox.nios_modules               1.5.0  
inspur.ispim                        1.3.0  
inspur.sm                           2.3.0  
junipernetworks.junos               5.3.1  
kubernetes.core                     2.4.0  
lowlydba.sqlserver                  2.2.2  
microsoft.ad                        1.4.1  
netapp.aws                          21.7.1 
netapp.azure                        21.10.1
netapp.cloudmanager                 21.22.1
netapp.elementsw                    21.7.0 
netapp.ontap                        22.8.3 
netapp.storagegrid                  21.11.1
netapp.um_info                      21.8.1 
netapp_eseries.santricity           1.4.0  
netbox.netbox                       3.15.0 
ngine_io.cloudstack                 2.3.0  
ngine_io.exoscale                   1.1.0  
ngine_io.vultr                      1.1.3  
openstack.cloud                     2.2.0  
openvswitch.openvswitch             2.1.1  
ovirt.ovirt                         3.2.0  
purestorage.flasharray              1.24.0 
purestorage.flashblade              1.14.0 
purestorage.fusion                  1.6.0  
sensu.sensu_go                      1.14.0 
servicenow.servicenow               1.0.6  
splunk.es                           2.1.2  
t_systems_mms.icinga_director       1.33.1 
telekom_mms.icinga_director         1.35.0 
theforeman.foreman                  3.15.0 
vmware.vmware_rest                  2.3.1  
vultr.cloud                         1.11.0 
vyos.vyos                           4.1.0  
wti.remote                          1.0.5  

Automation Controller Version
4.6.3
Event Driven Automation Version
1.1.2
Automation Hub Version
4.10.1
  • ansible installation method: one of source, pip, OS package, EE

OS / ENVIRONMENT

Desired Behavior

The dispatch role should run the user creation after the organization creation and before the user_role mapping.
There might be more simular problems with execution ordering of roles in the dispatch role.
This would resolve the error.

Actual Behavior

Please give some details of what is actually happening.
Include a [minimum complete verifiable example] with:

  • playbook / task
  roles:
    - infra.aap_configuration.dispatch

  • configuration file / list
gateway_applications.yml
gateway_authenticator_maps.yml
gateway_authenticators.yml
gateway_http_ports.yml
gateway_organizations.yml
gateway_role_user_assignments.yml
gateway_routes.yml
gateway_service_clusters.yml
gateway_service_keys.yml
gateway_service_nodes.yml
gateway_services.yml
gateway_settings.yml
gateway_teams.yml
gateway_users.yml

  • error
TASK [infra.aap_configuration.gateway_role_user_assignments : Role User Assignments | Wait for finish the configuration] *******************************************************************
task path: /home/wilco/.ansible/collections/ansible_collections/infra/aap_configuration/roles/gateway_role_user_assignments/tasks/main.yml:32
<aap_dev> ESTABLISH LOCAL CONNECTION FOR USER: wilco
<aap_dev> EXEC /bin/sh -c 'echo ~wilco && sleep 0'
<aap_dev> EXEC /bin/sh -c 'echo ~wilco && sleep 0'
<aap_dev> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/wilco/.ansible/tmp `"&& mkdir "` echo /home/wilco/.ansible/tmp/ansible-tmp-1734518669.9778216-9370-133732776628963 `" && echo ansible-tmp-1734518669.9778216-9370-133732776628963="` echo /home/wilco/.ansible/tmp/ansible-tmp-1734518669.9778216-9370-133732776628963 `" ) && sleep 0'
Using module file /home/wilco/.local/lib/python3.9/site-packages/ansible/modules/async_status.py
<aap_dev> PUT /home/wilco/.ansible/tmp/ansible-local-8500v7vk1nmz/tmpp5_114ns TO /home/wilco/.ansible/tmp/ansible-tmp-1734518669.9778216-9370-133732776628963/AnsiballZ_async_status.py
<aap_dev> EXEC /bin/sh -c 'chmod u+x /home/wilco/.ansible/tmp/ansible-tmp-1734518669.9778216-9370-133732776628963/ /home/wilco/.ansible/tmp/ansible-tmp-1734518669.9778216-9370-133732776628963/AnsiballZ_async_status.py && sleep 0'
<aap_dev> EXEC /bin/sh -c '/usr/bin/python3 /home/wilco/.ansible/tmp/ansible-tmp-1734518669.9778216-9370-133732776628963/AnsiballZ_async_status.py && sleep 0'
<aap_dev> EXEC /bin/sh -c 'rm -f -r /home/wilco/.ansible/tmp/ansible-tmp-1734518669.9778216-9370-133732776628963/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
  File "/tmp/ansible_ansible.platform.role_user_assignment_payload__bj31mnc/ansible_ansible.platform.role_user_assignment_payload.zip/ansible_collections/ansible/platform/plugins/module_utils/aap_module.py", line 264, in make_request
    response_body = response.read()
failed: [aap_dev] (item=Create/Update Role Organization Member | Wait for finish the Roles creation) => {
    "__gateway_role_user_assignments_job_async_results_item": {
        "__gateway_role_user_assignments_item": {
            "object_id": 2,
            "role_definition": "Organization Member",
            "user": "wilco"
        },
        "ansible_job_id": "j999485484068.9126",
        "ansible_loop_var": "__gateway_role_user_assignments_item",
        "changed": false,
        "failed": 0,
        "finished": 0,
        "results_file": "/home/wilco/.ansible_async/j999485484068.9126",
        "started": 1
    },
    "ansible_job_id": "j999485484068.9126",
    "ansible_loop_var": "__gateway_role_user_assignments_job_async_results_item",
    "attempts": 1,
    "changed": false,
    "finished": 1,
    "invocation": {
        "module_args": {
            "gateway_hostname": "https://aapserver3.localdomain:443",
            "gateway_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "gateway_request_timeout": 60.0,
            "gateway_token": null,
            "gateway_username": "admin",
            "gateway_validate_certs": false,
            "object_ansible_id": null,
            "object_id": 2,
            "role_definition": "Organization Member",
            "state": "present",
            "user": "wilco",
            "user_ansible_id": null
        }
    },
    "msg": "c{'user': 'Provide exactly one of user or user_ansible_id', 'user_ansible_id': 'Provide exactly one of user or user_ansible_id'}",
    "results_file": "/home/wilco/.ansible_async/j999485484068.9126",
    "started": 1,
    "stderr": "",
    "stderr_lines": [],
    "stdout": "",
    "stdout_lines": []
}

STEPS TO REPRODUCE

Create a simple configuration which adds a user and map the 'Organization admin' role to the same user.
Create a playbook to include the vars and run the aap_configuration.dispatch role.
This will give the above error

@hobby65 hobby65 added bug Something isn't working new New issue, this should be removed once reviewed labels Dec 18, 2024
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 New issue, this should be removed once reviewed
Projects
None yet
Development

No branches or pull requests

1 participant