Below playbook gets the disk usage percentage of ‘/tmp’ from a list of remote_hosts [20 remote servers] and stores it locally (delegate_to) in a file {{ playbook_dir }}/tmpfiles/stats.yml
`
Below playbook gets the disk usage percentage of ‘/tmp’ from a list of remote_hosts [20 remote servers] and stores it locally (delegate_to) in a file {{ playbook_dir }}/tmpfiles/stats.yml
`
Delegate to localhost does not change inventory_hostname, if it did it would break a lot of code out there.
And I can prove it with this code that mimic you codes behavior.
$ more test.yml