Minimize ssh connections number

Hello, everybody!

I use ansible for everyday production servers maintenance.
During run, ansible makes a lot of ssh connections to every server, every connection is logged and according to internal policy I have to write a note to the security journal about every ssh connection.
So, is there any way to minimize number of ssh connections? Say, lets ansible connect to ssh, do all recipes and disconnect instead of doing separate connections for every recipe?

I try to use accelerate=True mode, but it is buggy. Regularly i got “Failed to connect to xx.xx.xx.xx:5099” during ansible run, and i need to manully kill ansible-accelerate daemon to recover node.

Any ideas?

What version of Ansible are you using Alexey? Look at 'pipelining', that's probably what you're after. I think it needs a fairly recent ssh version too though.

ControlPersist is the way to reduce the number of connections.

Also don’t delegate_to a bunch to the same host.

See

Ansible Performance Tuning (for Fun and Profit)

1.7.2, from os x and ubuntu as control node, centos 6.5 as target. pipelining enabled.
and there are a lot of login records in the target machine /var/log/secure during every ansible run.

pipelining alone won’t do anything without Control Persist, but I’d check to make sure you weren’t using paramiko as the default SSH args do use CP.

I know. Just doublecheck it, ansible run ssh with CP option.