Playbook execution output async parallel exuction


if we execute a playbook in parallel on multiple hosts, the Ansible playbook execution output will be split into separate job logs on Foreman for each host. The task headlines will be added in a round-robin fashion, along with the task responses for each task in each log. However, it is not readable anymore.

Job Host 1

TASK [Gathering Facts] *********************************************************
ok: [rssandbox..]
ok: [rssandbox...]
ok: [rssandbox...] => {

Job Host 2

TASK [Set revision directory] **************************************************
ok: [hanahsba...]

TASK [Show revision directory for HANA SID] ************************************
ok: [hanahsba...] => {

Is it possible to force to add the Task Headline for each Job in parallel execution?

Best rgards

What versions of Foreman and foreman_ansible are you using?
Does it also happen when you run the Ansible roles on a single host?
I would add here a screenshot if possible :slight_smile:

Hi nofaralfasi; its 3.6.1. We execute Tasks asycnron on multi hosts.


if we execute a playbook in parallel on multiple hosts

What exactly do you mean by that? Are you by any chance using a non-default ansible strategy?

We use the following methods to execute tasks:

  1. Navigate to “Hosts > Job Templates > Run,” select multiple hosts, and execute the task.or
  2. Navigate to “Hosts > hostgroup_fullname / host_collection” to choose multiple hosts for execution.

The main problem is that, during each execution, the logs of each host split the task headline among the hosts just once. Additionally, the task status is logged separately for each host and execution.

We would like the task headline to be included in each individual log for every host execution.

In general it should just work and I’m not aware of any reports that this was broken in the release you’re on. I can at least confirm it indeed does work on 3.9.1.

I can somewhat reproduce the issue you’re describing if I switch the ansible execution strategy to free, either directly in the playbook I’m running or in /etc/ansible/ansible.cfg. Are you using a non-default ansible strategy?

As far I can see it’s configured

[root@ ansible]# grep strategy /etc/ansible/ansible.cfg
(string) Set the default strategy used for plays.
;strategy_plugins={{ ANSIBLE_HOME ~ “/plugins/strategy:/usr/share/ansible/plugins/strategy” }}

The relevant playbooks are not set to strategy: free

and we allowed:


We solved the issue.

We moved all variabelized infos to msg: or debug varibale into the task itself.
If the task headline is matching over all executed scripts as string the output is in sync.