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?
Do you need to run it from the gui or from external workflow like rest APi?
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?
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
thats sounds like a solution.
Is it possible to kick-off awx-cli from a playbook within awx?
Yes ,
awx.awx.tower_job_launch – Launch an Ansible Job. — Ansible Documentation
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.
- 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