delegate_to & run_once for Orchestration
Run a task on one host for many.
Tasks Do Not Always Run Where You Think
By default each task runs on its target host. For orchestration you sometimes need a task to run somewhere else entirely. 🎯
Meet delegate_to
The delegate_to keyword runs a task on a different host than the current one, while still using that host's variables.
- name: Add web node to load balancer
community.general.haproxy:
host: "{{ inventory_hostname }}"
state: enabled
delegate_to: lb01All lessons in this course
- Automating Network Devices with cli_command
- delegate_to & run_once for Orchestration
- Coordinate Web, App & DB Tiers
- Load Balancer Drain & Re-Enable