Delegation - Multiple and Parallel

Hi,

For plays, the “hosts” element accepts multiple hosts separated by colon. That is,

hosts: “host1:host2:host3”

  • works. However, within a task, when delegating to other hosts, the same pattern does not seem to work. That is,

delegate_to: “host1:host2:host3”

  • doesn’t appear to work. I get a “ControlPath too long” error, possibly because ansible is interpreting the concatenated hosts as a single host.

So, how do can a task be delegated to multiple hosts and run on them in parallel?

Any insight into this is appreciated.

Regards

you can delegate to multiple hosts, but not run them in paralell

- task:
  delegate_to: "{{item}}"
  with_items:
     - host1
     - host2
     - host3