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

"extra_vars": ["Not a valid string."] in ansible.controller.ad_hoc_command #14481

Closed
5 of 11 tasks
Alffernandez opened this issue Sep 25, 2023 · 0 comments · Fixed by #14585
Closed
5 of 11 tasks

"extra_vars": ["Not a valid string."] in ansible.controller.ad_hoc_command #14481

Alffernandez opened this issue Sep 25, 2023 · 0 comments · Fixed by #14585
Assignees
Labels
component:awx_collection issues related to the collection for controlling AWX type:bug

Comments

@Alffernandez
Copy link

Alffernandez commented Sep 25, 2023

Please confirm the following

  • I agree to follow this project's code of conduct.
  • I have checked the current issues for duplicates.
  • I understand that AWX is open source software provided for free and that I might not receive a timely response.
  • I am NOT reporting a (potential) security vulnerability. (These should be emailed to [email protected] instead.)

Bug Summary

When use try to set extra_vars from the module ansible.controller.ad_hoc_command , you get the following error:

FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/libexec/platform-python"}, "changed": false, "msg": "Failed to launch command, see response for details", "response": {"json": {"extra_vars": ["Not a valid string."]}, "status_code": 400}}

According to ansible.controller collection's official documentation, parameter "extra_vars" is a type of dictionary but, according to Tower API official documentation, parameter "extra_vars" is a type of string.

I have been testing with other modules, which require the extra_vars e.g (ansible.controller.job_launch), and it's working.

AWX version

4.4.2

Select the relevant components

  • UI
  • UI (tech preview)
  • API
  • Docs
  • Collection
  • CLI
  • Other

Installation method

N/A

Modifications

no

Ansible version

ansible [core 2.15.0]

Operating system

RHEL 8.8

Web browser

Chrome

Steps to reproduce

  1. Create a playbook which contains the module ansible.controller.ad_hoc_command:
- hosts: all
  gather_facts: false
  tasks:
    - name: Launch an ad hoc command
      ansible.controller.ad_hoc_command:
        controller_host: <Controller_host>
        controller_username: <Controller_user>
        controller_password: <Controller_password>
        credential: "test credentials"
        inventory: "test inventory"
        module_name: "ping"
        extra_vars:
          var1: "My First Variable"
  1. Run the playbook.
  2. Check the output:
TASK [Launch an ad hoc command] **************************************************************************************************************************************************************************************************************
fatal: [<Controller_host>]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/libexec/platform-python"}, "changed": false, "msg": "Failed to launch command, see response for details", "response": {"json": {"extra_vars": ["Not a valid string."]}, "status_code": 400}}

A similar playbook with the module ansible.controller.job_launch works successfully:

ansible.controller.job_launch:
  job_template: "github test"
    extra_vars:
          var1: "My First Variable"
          var2: "My Second Variable"
          var3: "My Third Variable"
    job_type: run

Expected results

Add extra variables with the module ansible.controller.ad_hoc_command:

Actual results

Not able to use the extra_vars

Additional information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:awx_collection issues related to the collection for controlling AWX type:bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants