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

filetree_create not able to call awx.awx.controller_api properly #8

Closed
dancorrigan1 opened this issue Nov 25, 2024 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@dancorrigan1
Copy link

Summary

I'm using AWX 23.7.0
In my playbook, I create an auth token and assign controller_oauthtoken and controller_oauthtoken_url then import infra.controller_configuration.filetree_create
I also have controller_api_plugin set to awx.awx.controller_api
my import_role task imports infra.controller_configuration.filetree_create
Inside that role, when it calls the task:

  • name: "Get the Tower/AAP instance version"
    ansible.builtin.set_fact:
    aap_version: "{{ lookup(controller_api_plugin, 'ping',
    host=controller_hostname, oauth_token=controller_oauthtoken,
    verify_ssl=controller_validate_certs).version }}"

The task is failing with: "msg": "the field 'args' has an invalid value ({'aap_version': "{{ lookup(controller_api_plugin, 'ping', host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs).version }}"}), and could not be converted to an dict.The error was: unmarshallable object\n\nThe error appears to be in '/usr/share/ansible/collections/ansible_collections/infra/controller_configuration/roles/filetree_create/tasks/all.yml': line 2, 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: "Get the Tower/AAP instance version"\n ^ here\n",

I am successful if I create a fact the same way the infra role is calling awx.awx.controller_api with: lookup('awx.awx.controller_api', 'ping', host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs).version }}

Issue Type

  • Bug Report

Ansible, Collection, Controller details

name: infra.controller_configuration
version: 2.11.0
source: https://galaxy.ansible.com/
name: awx.awx
version: 24.6.1
source: https://galaxy.ansible.com/
ansible [core 2.16.3]
  config file = None
  configured module search path = ['/runner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.11/site-packages/ansible
  ansible collection location = /runner/requirements_collections:/runner/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.11.5 (main, Jan  9 2024, 00:00:00) [GCC 11.4.1 20231218 (Red Hat 11.4.1-3)] (/usr/bin/python3.11)
  jinja version = 3.1.3
  libyaml = True

# /usr/share/ansible/collections/ansible_collections
Collection                     Version
------------------------------ -------
ansible.posix                  1.6.2  
ansible.scm                    3.0.0  
ansible.utils                  5.1.2  
ansible.windows                2.5.0  
awx.awx                        24.6.1 
community.general              10.0.1 
community.vmware               5.1.0  
community.windows              2.3.0  
infra.controller_configuration 2.11.0 
vmware.vmware                  1.6.0 

AWX 23.7.0
  • ansible installation method: EE based upon quay.io/centos/centos:stream9-minimal

OS / ENVIRONMENT

CentOS Stream 9

Desired Behavior

filetree_create collects my information from AWX Server

Actual Behavior

TASK [infra.controller_configuration.filetree_create : Include Tasks to get all objects of type ['labels']] ***
task path: /usr/share/ansible/collections/ansible_collections/infra/controller_configuration/roles/filetree_create/tasks/main.yml:48
included: /usr/share/ansible/collections/ansible_collections/infra/controller_configuration/roles/filetree_create/tasks/all.yml for localhost
TASK [infra.controller_configuration.filetree_create : Get the Tower/AAP instance version] ***
task path: /usr/share/ansible/collections/ansible_collections/infra/controller_configuration/roles/filetree_create/tasks/all.yml:2
fatal: [localhost]: FAILED! => {
    "msg": "the field 'args' has an invalid value ({'aap_version': \"{{ lookup(controller_api_plugin, 'ping', host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs).version }}\"}), and could not be converted to an dict.The error was: unmarshallable object\n\nThe error appears to be in '/usr/share/ansible/collections/ansible_collections/infra/controller_configuration/roles/filetree_create/tasks/all.yml': line 2, 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: \"Get the Tower/AAP instance version\"\n  ^ here\n"
}

STEPS TO REPRODUCE

---
- name: AWX Filefree
  hosts: all
  gather_facts: false
  tasks:

    - name: "Get auth token"
      ansible.builtin.uri:
        url: "https://{{ controller_hostname }}/api/v2/tokens/"
        user: "{{ controller_username }}"
        password: "{{ controller_password }}"
        method: POST
        force_basic_auth: true
        validate_certs: "{{ controller_validate_certs }}"
        status_code: 201
      register: __auth_token

    - name: "Set the oauth token to be used since now"
      ansible.builtin.set_fact:
        controller_oauthtoken: "{{ __auth_token.json.token }}"
        controller_oauthtoken_url: "{{ __auth_token.json.url }}"
        controller_api_plugin: 'awx.awx.controller_api'
        controller_configuration_filetree_create_secure_logging: false
      no_log: false

    - name: Import filetree role
      ansible.builtin.import_role:
        name:   
      vars:
        input_tag:
          - 'labels'
... 
@dancorrigan1 dancorrigan1 added the bug Something isn't working label Nov 25, 2024
@bogdanmuresan
Copy link
Contributor

Hello, I had the same issue here: redhat-cop/infra.aap_configuration#741
It was a bug with ansible, which was fixed here:
ansible/ansible#82759
which references
ansible/ansible#82708
which seems to have been merged into 2.16.5 (https://github.com/ansible/ansible/blob/v2.16.10/changelogs/CHANGELOG-v2.16.rst#v2165)

I see you have ansible 2.16.3 - I would try updating to at least 2.16.5

@dancorrigan1
Copy link
Author

Hello, I had the same issue here: redhat-cop/infra.aap_configuration#741 It was a bug with ansible, which was fixed here: ansible/ansible#82759 which references ansible/ansible#82708 which seems to have been merged into 2.16.5 (https://github.com/ansible/ansible/blob/v2.16.10/changelogs/CHANGELOG-v2.16.rst#v2165)

I see you have ansible 2.16.3 - I would try updating to at least 2.16.5

Bingo bango. Upgraded my ansible and now it is working.
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants