I'm working with Ansible and many of servers every day, so let me show you, how can waste less of your time! :)
- Connects, runs, check, sends back, processes it, runs, checks, sends back and voila!
- Connects... again... and again... and again...
Edit sshd config and disable UseDNS, it's mainly used only for logging and authentication. But.. only when you have set IgnoreRhosts in your config. So who doesn't know, should use it with clean mind. Because this has truly so far with security. :)
UseDNS no
Create needed directory:
mkdir ~/.ssh/sockets
~/.ssh/config
Host *
ControlMaster auto
ControlPath ~/.ssh/sockets/%r@%h-%p
ControlPersist 600
PreferredAuthentications=publickey
Every additional connection will cost a lot of additional time.. :) The main feature in latest releases of Ansible is pipelining. Try to use this configuration in ansible.cfg.
Follow Ansible documentation (put it into ansbile.cfg)
- ANSIBLE_CONFIG (an environment variable)
- ansible.cfg (in the current directory)
- ~/.ansible.cfg (in the home directory)
- /etc/ansible/ansible.cfg