Maybe not a problem, more like a question, is this possible?
If I want to run an Ansible playbook against multiple hosts from within the Forman UI I have two options.
select a number of hosts and then Action > Play Ansible Roles
select a number of hosts and then Action > Schedule Remote Job > Ansible Playbook and then select an Ansible Role Template, choosing a simple template with "hosts: all and the role: <name of my role that lives at /etc/ansible roles>
When I go the second route what I notice is that the Foreman does a complete ansible-playbook execute for each host individually versus one ansible-playbook run with all of the hosts I just selected as my inventory.
I’m not sure if the same happens under the hood when one does “Action > Play Ansible Roles”
Maybe I need something in my template? My template is very simple just:
“would be nice” outcome - select 10 hosts, select Schedule Remote job and select my Ansible role and then TFM runs ansible-playbook with an inventory of 10 hosts versus running “ansible-playbook” 10 times, one host for each complete ansible-playbook run.
Of course I can just do this from the command line and use the dynamic inventory script but hey, I’m lazy
Foreman and Proxy versions:
Ansible Smartpoxy 2.0.3
Foreman and Proxy plugin versions:
in both cases ansible-playbook is ran separately. This gives us possibility to use REX scaling mechanisms. In future we might modify the integration so that we’d generate inventory with all info for all hosts. We’ll see if ansible-runner would get us closer to that.
I have tried the ansible-runner today, but the same result. One host will still run an independent ansible process. run_once and concurrency level are both not working.
BTW, the concurrency level will stop the job to be updated. when the first batch is finished, the second batch will change from planned to running (howvere, in fact, the second and the rest batches are already finished in parallel with first batch), and the second batch running status will last forever.
I got the ansible-runner to work. But its sort of disappointing. My job takes ~20 minutes to finish and there are 300+ in a call. It sometimes failed the 4th batch with no reason. Seems some limitation was met.
Even if the running batches, it would stuck occasionally and forever, don;t know where to find logs.
BTW, the concurrency level doesn’t work with ansible-runner neither