BTW, I've done quite a bit of API work on the command line using curl and this site is quite useful: https://json.parser.online.fr/
I was able to paste in your original code and easily see that "targets" is only going to be evaluated once (to "dev-cn-c2") by looking at the YAML. Or if you pasted in your original YAML, you would see the JSON that you could use also showing the "[]" lists. On Saturday, April 27, 2019 at 12:54:19 PM UTC-5, [email protected] wrote: > > I believe your JSON on the command line is incorrect - I'd bet that your > example only runs against the "dev-cn-c2" target, correct? > > Try this for the data to pass: > > { "extra_vars": { "domain": "dom-cn-1", "targets": [ "dev-cn-c1", > "dev-cn-c2" ] , "fwcmd": "fw sam -v -J src 192.168.10.10" }} > > Note that the targets are placed in square brackets to make them a list. > > On Saturday, April 27, 2019 at 6:14:47 AM UTC-5, ATHIRA sanoj wrote: >> >> Hello Team >> >> team i am trying to launch a template with list of variable_value but >> task is getting executed only in one target host >> >> >> *sample request* >> >> >> curl -H "Content-Type: application/json" -X POST -s -u admin:admin123 -d >> '{ "extra_vars": { "domain": "dom-cn-1", "targets": "dev-cn-c1", "targets": >> "dev-cn-c2", "fwcmd": "fw sam -v -J src 192.168.10.10" }}' -k >> https://172.16.102.4/api/v2/job_templates/10/launch/ >> >> >> this is working as expected when i run via cli playbook. >> >> >> >> *##vars file snip* >> >> domain: dom-cn-1 >> targets: >> - dev-cn-c1 >> - dev-cn-c2 >> >> >> *###Playbook file* >> >> - name: "Create output file" >> check_point_mgmt: >> command: run-script >> parameters: >> script-name: "Create output file" >> script: "fw sam -v -J src 192.168.10.10" >> targets: "{{ targets }}" >> session-data: "{{login_response}}" >> >> -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/33cec5c5-b870-4264-b9ec-9e0c78c6b5a2%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
