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

Lookup with dynamic names throw error with ansible 2.15.8 #741

Closed
bogdanmuresan opened this issue Dec 18, 2023 · 6 comments
Closed

Lookup with dynamic names throw error with ansible 2.15.8 #741

bogdanmuresan opened this issue Dec 18, 2023 · 6 comments
Labels
bug Something isn't working filetree/object_diff inactive No movement has happened in 30 days

Comments

@bogdanmuresan
Copy link
Contributor

bogdanmuresan commented Dec 18, 2023

Summary

With latest AAP installation (Ansible Automation Platform 2.4.3 - controller 4.4.8) we get following error:
We could also replicate it by updating the execution env image, to one that has ansible [core 2.15.8]
It works on ones with ansible [core 2.15.5]

TASK [infra.controller_configuration.object_diff : Check if the connection is to an Ansible Tower or to Automation Platform] ***
fatal: [localhost]: FAILED! => {"msg": "the field 'args' has an invalid value ({'is_aap': \"{{ lookup(controller_api_plugin, 'ping', host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs).version is version('4.0.0', '>=') }}\"}), and could not be converted to an dict.The error was: unmarshallable object\n\nThe error appears to be in '/runner/requirements_collections/ansible_collections/infra/controller_configuration/roles/object_diff/tasks/main.yml': line 53, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: \"Check if the connection is to an Ansible Tower or to Automation Platform\"\n  ^ here\n"}
  "msg": "the field 'args' has an invalid value ({'is_aap': \"{{ lookup(controller_api_plugin, 'ping', host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs).version is version('4.0.0', '>=') }}\"}), and could not be converted to an dict.The error was: unmarshallable object\n\nThe error appears to be in '/runner/requirements_collections/ansible_collections/infra/controller_configuration/roles/object_diff/tasks/main.yml': line 53, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: \"Check if the connection is to an Ansible Tower or to Automation Platform\"\n  ^ here\n"

pointing the issue to the code here:
https://github.com/redhat-cop/controller_configuration/blob/2.5.2/roles/object_diff/tasks/main.yml#L55

After doing some debugging, I could only make it work by replacing the "controller_api_plugin" variable in the lookup with the actual value - 'awx.awx.controller_api'.

next failure is

fatal: [localhost]: FAILED! => {
    "msg": "the field 'args' has an invalid value ({'__projects_difference': '{{ query(controller_role_plugin, api_list=__controller_api_projects, compare_list=controller_projects, with_present=include_present_state, set_absent=true) | flatten }}'}), and could not be converted to an dict.The error was: unmarshallable object\n\nThe error appears to be in '/runner/requirements_collections/ansible_collections/infra/controller_configuration/roles/object_diff/tasks/projects.yml': line 19, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: \"Find the difference of Project between what is on the Controller versus CasC on SCM\"\n  ^ here\n"
}

same unmarshallable error, this time with query.

Issue Type

  • Bug Report

Ansible, Collection, Controller details

ansible --version
 podman run --rm -it --entrypoint /bin/bash registry.redhat.io/ansible-automation-platform-24/ee-minimal-rhel8:latest
bash-4.4# ansible --version
ansible [core 2.15.8]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/runner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.9/site-packages/ansible
  ansible collection location = /home/runner/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.9.18 (main, Sep 22 2023, 17:58:34) [GCC 8.5.0 20210514 (Red Hat 8.5.0-20)] (/usr/bin/python3.9)
  jinja version = 3.1.2
  libyaml = True
ansible-galaxy collection list

Controller version
4.4.8
Ansible Automation Platform 2.4.3

  • ansible installation method: one of source, pip, OS package, EE

OS / ENVIRONMENT

AAP

Desired Behavior

Actual Behavior

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

  • playbook / task
  • configuration file / list
  • error

STEPS TO REPRODUCE

@bogdanmuresan bogdanmuresan added bug Something isn't working new New issue, this should be removed once reviewed labels Dec 18, 2023
@bogdanmuresan bogdanmuresan changed the title Does not work with latest AAP (or newer EE images) Lookup with dynamic names throw error Does not work with latest AAP (or newer EE images/ansible version) Lookup with dynamic names throw error Dec 18, 2023
@bogdanmuresan bogdanmuresan changed the title Does not work with latest AAP (or newer EE images/ansible version) Lookup with dynamic names throw error Lookup with dynamic names throw error with ansible 2.15.18 Dec 18, 2023
@bogdanmuresan bogdanmuresan changed the title Lookup with dynamic names throw error with ansible 2.15.18 Lookup with dynamic names throw error with ansible 2.15.8 Dec 18, 2023
@github-actions github-actions bot added the inactive No movement has happened in 30 days label Jan 18, 2024
@simon-mags
Copy link

Can confirm we are seeing this same lookup error with the invalid "is_aap" field. We are running Ansible Automation Platform 2.4 with Controller 4.4.5.

We dropped the Execution Environment back to 1.0.0.-464 which runs Ansible Core 2.15.5 as pointed out by @bogdanmuresan already and then we were able to run the filetree_create commands etc as normal

@github-actions github-actions bot removed the inactive No movement has happened in 30 days label Feb 16, 2024
@djdanielsson
Copy link
Collaborator

we will have to look into this more, we cannot use FQCN in this case because some users use awx.awx and others use ansible.controller

@djdanielsson djdanielsson added filetree/object_diff and removed new New issue, this should be removed once reviewed labels Feb 29, 2024
@jonesalexr
Copy link

I confirm i see this as well running AWX 23.2 to 23.8. I can not run the filetree_create role on any ansible core newer than 2.15.6. I just target an older EE "awx-ee:23.4.0" until this is resolved.

@ecchong
Copy link
Contributor

ecchong commented Mar 6, 2024

I found that using a debug task to perform a useless lookup before the filetree_create role can temporary suppress the problem using current EE

- name: TODO - work around
  ansible.builtin.debug:
    msg: "{{ lookup('ansible.controller.controller_api', 'ping',
                    host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs) }}"

@adonisgarciac
Copy link
Contributor

This issue comes from this change from ansible 2.15.7: ansible/ansible#82708.

It seems it is solved for 2.16 https://github.com/ansible/ansible/pull/82759/files

@adonisgarciac
Copy link
Contributor

The fix was backported to 2.14 and 2.15. I think we can close this issue because it is a bug in Ansible Core. It was solved and it will be working property again in next releases. Meanwhile, I suggest to use ansible 2.15.6 while it is possible.

ansible/ansible#82791
ansible/ansible#82790

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working filetree/object_diff inactive No movement has happened in 30 days
Projects
None yet
Development

No branches or pull requests

7 participants