-2

Can some one tell how to pass multiple extra_vars variables from the command line which will run the Job Template in Tower?

I've followed Ansible documentaion https://docs.ansible.com/ansible-tower/latest/html/userguide/job_templates.html#passing-extra-variables-to-provisioning-callbacks

curl -f -H 'Content-Type: application/json' -XPOST \
                  -d '{"host_config_key": "efref3d9-740f-429c-43r2-15t326b76", "extra_vars": "{\"Job_ID\": \"24\"},{\"job_templates\": \"test99\"}"}' \
                  https://tower-ansible.com:443/api/v2/job_templates/822/callback/ -k

For single variable it's working. Below curl command works with single extra variable

curl -f -H 'Content-Type: application/json' -XPOST     -d '{"host_config_key": "efref3d9-740f-429c-43r2-15t323b76", "extra_vars": "{\"job_id\": \"24\"}"}'     https://tower-ansible.com:443/api/v2/job_templates/822/callback/ -k
U880D
  • 8,601
  • 6
  • 24
  • 40
A Prakash
  • 7
  • 3

1 Answers1

0

According the documentation about Passing Extra Variables to Provisioning Callbacks you have referenced you may

Use the following JSON format as an example when adding your own extra_vars to be passed

"extra_vars": {"variable1":"value1","variable2":"value2",...}

instead of as in your provided example

"extra_vars": {"variable1":"value1"},{"variable2":"value2"}
U880D
  • 8,601
  • 6
  • 24
  • 40
  • I tried with this aswell, but its not working. – A Prakash Dec 15 '22 at 14:16
  • Can you describe in more detail what you have tried and what is not working? To do so can you examples together with resulting outputs and by editing the initial question? – U880D Dec 15 '22 at 14:39