Which SSH settings matter for performance and stability?
IntermediateProductionPerformance and Scale
Answer
[ssh_connection]
ssh_args = -o ControlMaster=auto -o ControlPersist=120s -o ServerAliveInterval=30 -o ServerAliveCountMax=5
control_path_dir = ~/.ansible/cp
pipelining = True
retries = 3
ControlPersist reuses connections; keep-alives stop NAT or load balancers from dropping idle sessions during long tasks; retries re-attempts transient connection failures. Use a short control_path_dir, since socket paths have a length limit. On very slow or high-latency links, fewer and larger tasks matter more than any flag.
More on Performance and Scale
Why can Ansible be slower than a shell script for 100 servers, and what dominates the time?BeginnerHow do you choose the `forks` value?BeginnerWhat is SSH pipelining and why does it help?BeginnerHow do you find out which tasks are slow?BeginnerHow do you reduce the cost of fact gathering?IntermediateWhat is Mitogen for Ansible and would you use it?Advanced