I have a playbook which will be run on many servers (say ten). The first three tasks will be run on the remote servers. The last task of merging is done on localhost (Ansible controller).
When I run this playbook, the merging is happening each time (i.e.: ten times).
I want to do the merging task only one time, once all the above tasks are completed on all servers.
---
- name: Find the location
debug:
- name: Extract details
debug:
- name: Create csv file
debug:
- name: Merge files
debug:
delegate_to: localhost
Use run_once to achieve this:
- hosts: all
tasks:
- name: do this on every host
debug:
- name: do this once on localhost
debug:
delegate_to: localhost
run_once: true
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With