# Use a template with multiple inventories and multiple organizations

**URL:** <https://forum.ansible.com/t/use-a-template-with-multiple-inventories-and-multiple-organizations/35456>\
**Category:** AWX Project\
**Tags:** awx\
**Created:** [July 2, 2021, 7:48pm UTC](https://forum.ansible.com/t/use-a-template-with-multiple-inventories-and-multiple-organizations/35456 "2021-07-02T19:48:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![daemenseth](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/daemenseth/32/677_2.png) [@daemenseth](https://forum.ansible.com/u/daemenseth)\
**Post date:** [July 2, 2021, 7:48pm UTC](https://forum.ansible.com/t/use-a-template-with-multiple-inventories-and-multiple-organizations/35456/1 "2021-07-02T19:48:43Z")

</div>

We have multiple organizations in AWX. Between then their individual organizations But some default jobs we want to run on multiple organizations. But in a template you can choose only one inventory and not multiple

We can make a default template for every customer and make then one workflow with all customers in it.

But this ends up with a lot off templates. Is there a better way?

---

<div class="post-metadata">

**Author:** ![Wei-Yen\_Tan](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/wei-yen_tan/32/4111_2.png) [@Wei-Yen\_Tan](https://forum.ansible.com/u/Wei-Yen_Tan)\
**Post date:** [July 2, 2021, 7:51pm UTC](https://forum.ansible.com/t/use-a-template-with-multiple-inventories-and-multiple-organizations/35456/2 "2021-07-02T19:51:20Z")

</div>

Do you need to run it from the gui or from external workflow like rest APi?

---

<div class="post-metadata">

**Author:** ![daemenseth](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/daemenseth/32/677_2.png) [@daemenseth](https://forum.ansible.com/u/daemenseth)\
**Post date:** [July 2, 2021, 7:53pm UTC](https://forum.ansible.com/t/use-a-template-with-multiple-inventories-and-multiple-organizations/35456/3 "2021-07-02T19:53:41Z")

</div>

Mosty we use the gui.  
But when It is only posible with external workflow that is also a solution for me.  
Why you asking that, whats the difference?

---

<div class="post-metadata">

**Author:** ![Wei-Yen\_Tan](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/wei-yen_tan/32/4111_2.png) [@Wei-Yen\_Tan](https://forum.ansible.com/u/Wei-Yen_Tan)\
**Post date:** [July 2, 2021, 7:55pm UTC](https://forum.ansible.com/t/use-a-template-with-multiple-inventories-and-multiple-organizations/35456/4 "2021-07-02T19:55:52Z")

</div>

What you could do is use awx-cli to kick off jobs and in the template yoy can set inventory for prompt. When you set the inventory to prompt you can then specify the inventory you want to target using awx-cli and then loop through the inventories you want

---

<div class="post-metadata">

**Author:** ![daemenseth](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/daemenseth/32/677_2.png) [@daemenseth](https://forum.ansible.com/u/daemenseth)\
**Post date:** [July 2, 2021, 8:05pm UTC](https://forum.ansible.com/t/use-a-template-with-multiple-inventories-and-multiple-organizations/35456/5 "2021-07-02T20:05:01Z")

</div>

thats sounds like a solution.  
Is it possible to kick-off awx-cli from a playbook within awx?

---

<div class="post-metadata">

**Author:** ![Wei-Yen\_Tan](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/wei-yen_tan/32/4111_2.png) [@Wei-Yen\_Tan](https://forum.ansible.com/u/Wei-Yen_Tan)\
**Post date:** [July 2, 2021, 8:13pm UTC](https://forum.ansible.com/t/use-a-template-with-multiple-inventories-and-multiple-organizations/35456/6 "2021-07-02T20:13:00Z")

</div>

Yes ,

[awx.awx.tower\_job\_launch – Launch an Ansible Job. — Ansible Documentation](https://docs.ansible.com/ansible/latest/collections/awx/awx/tower_job_launch_module.html)

This is the ansible task that uses awx-cli in the background.

TLDR, there is a example in the documentation. You can just just have multiple tasks of this for your inventory. I hope that helps.

```auto
- name: Launch a job with inventory and credential
  tower_job_launch:
    job_template: "My Job Template"
    inventory: "My Inventory"
    credential: "My Credential"
  register: job
- name: Wait for job max 120s
  tower_job_wait:
    job_id: "{{ [job.id](http://job.id) }}"
    timeout: 120

```
