# awx/tower api help wanted

**URL:** <https://forum.ansible.com/t/awx-tower-api-help-wanted/30204>\
**Category:** Ansible Project\
**Tags:** awx\
**Created:** [April 27, 2019, 11:14am UTC](https://forum.ansible.com/t/awx-tower-api-help-wanted/30204 "2019-04-27T11:14:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ATHIRA\_sanoj](https://avatars.discourse-cdn.com/v4/letter/a/3ab097/32.png) [@ATHIRA\_sanoj](https://forum.ansible.com/u/ATHIRA_sanoj)\
**Post date:** [April 27, 2019, 11:14am UTC](https://forum.ansible.com/t/awx-tower-api-help-wanted/30204/1 "2019-04-27T11:14:47Z")

</div>

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

```auto
    - 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}}"

```

---

<div class="post-metadata">

**Author:** ![dan\_linder](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dan_linder/32/3833_2.png) [@dan\_linder](https://forum.ansible.com/u/dan_linder)\
**Post date:** [April 27, 2019, 5:54pm UTC](https://forum.ansible.com/t/awx-tower-api-help-wanted/30204/2 "2019-04-27T17:54:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dan\_linder](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dan_linder/32/3833_2.png) [@dan\_linder](https://forum.ansible.com/u/dan_linder)\
**Post date:** [April 27, 2019, 6:03pm UTC](https://forum.ansible.com/t/awx-tower-api-help-wanted/30204/3 "2019-04-27T18:03:52Z")

</div>

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/](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.
