3 ms·
You shouldn't be creating ssh connections all the time, but instead using persistent connection to each server that ansible opens once at the beginning, and reu
by pferde 7y ago
You shouldn't be creating ssh connections all the time, but instead using persistent connection to each server that ansible opens once at the beginning, and reuses for all subsequent tasks.
See ControlPersist/ControlPath OpenSSH client configuration.
- mattbillenstein 7y agoNever found this incredibly reliable - and if you change networks, sleep, or power off your machine, those connections die. Salt is just better at all of this imho.
- mattbillenstein 7y agoI mean, I guess if you use a dedicated host, it's more reliable - but I've always just pushed from the client using Ansible whereas with Salt you have the master running the cloud running somewhere most usually.
- pferde 7y agoDo you often do these things in the middle of running a playbook? I would hope not. :) It's not meant to have the connections persist forever, just long enough for repeated short ssh connections to have almost no overhead, and therefore be much faster.
- mattbillenstein 7y agoYeah, good point.
- fanf2 7y agoAnd for even more speedup, use Mitogen https://mitogen.networkgenomics.com/ansible_detailed.html https://mitogen.networkgenomics.com/ansible_detailed.html