How to pass arrays to AWX/Ansible Tower

1k views Asked by At

I'm calling AWX template from ManageIQ. I'm passing 9 variables to the playbook (with prompt on launch active). The playbook is successfully called, and all of the vars come through. However two of the vars are supposed to be arrays. Instead they come through to AWX as strings: e.g., '["chefclient"]' instead of ["chefclient"].

I have confirmed that these vars are indeed of type array in ManageIQ before I pass them to the AWX template.

Any clue why this is happening? Do all vars get irresistibly converted to strings? How do I fix this?

Thank you!

3

There are 3 answers

0
208_man On BEST ANSWER

According to the RedHat developers on Gitter.im, this is a shortcoming in the launch_ansible_method in ManageIQ. I.e., it always converts arrays to strings. We have opened an issue on GitHub to address this.

6
altair66 On

I have basically had a variable in ansible tower/awx that takes input as Text with server names as array/List. example: ["node1","node2","node3"] and once job is launched I can see the variable in the extra variables as '["node1","node2","node3"]'. I'm not sure about reason why it does that but it doesn't effect your subsequent ansible operations on that variable. Not all variables gets single quotations only when you use array/List.

2
altair66 On

I have tried to replicate this on my end with AWX installed locally. I have passed v_packages variables data as ["apache2","nginx"]. I don't see that issue now. output

job output