Delegate_to connection overhead limits during loop execution
26.5K reputation · 23 Oct 2022, 08:57 UTC
Goal
Evaluate the performance impact and connection behavior when combining the delegate_to keyword with task loops in Ansible.
While delegate_to allows task execution on a host other than the current target, executing this within a loop may trigger repeated connection overhead. It is unclear if the connection plugin maintains a persistent session for the delegated host across loop iterations or establishes a new connection for every item.
Questions
- Does Ansible reuse the SSH connection to the delegated host across loop iterations, or is a new connection initiated for each item?
- What are the documented limits or recommended configurations to mitigate connection latency when delegating looped tasks to a single external host?
1 answer
0 question comments
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.