I’m interested in making use of job templates that I would like to make use of the Ansible free strategy with (ansible.builtin.free strategy – Executes tasks without waiting for all hosts — Ansible Documentation)
I wrote a simple POC job template which looks like this:
---
- name: Test Free
hosts: all
strategy: free
tasks:
- name: Sleep
command: sleep 600
when: inventory_hostname == "host1"
- name: Print
command: echo 'Test'
Now it does successfully run the playbook when I run it as a remote job against hosts 1 and 2.
However when I look at the output for host2 it looks like this:
Play [Test Free] *************************************************
ok: [host2]
Task [Sleep] *****************************************************
skipping: [host2]
changed: [host2]
PLAY RECAP ***************************************************
host2 : ok=2. changed=1 unreachable=0 failed=0 skipped=1 rescued=0 ignored=0
I’m thinking the last “changed” comes from the Print task but I’m not sure why utilizing the free strategy seems to stop that from outputting as expected (In this particular scenario the output for host1 does look exactly as you would expect)
Just wanted to see if anyone had any suggestions or utilizing Ansible strategies other than linear are things that can potentially work with Foreman