So, I have made a custom Ansible setup for more than 4000 servers in 12 different countries across the planet, and that gave me some insight into how to make it perform better.
First of all, sadly Ansible doesn’t yet support “proxy / caching servers” as in servers that you could use to execute playbook through. You can configure SSH proxy server, but that won’t help with performance. Only way to execute playbook from another server is to install Ansible there as well, sync the playbooks somehow and execute from this host.
Anyway, now for the performance hacks.
Major boost in performance. Simply install redis server on same host as Ansible and put this to configuration of ansible:
[defaults] fact_caching = redis fact_caching_timeout = 86400 fact_caching_connection = localhost:6379:0 gathering = smart
This will put all facts of every server you connect to into redis cache and next time you execute anything on that server (within 1 day), ansible will not gather facts again, but it would take them from redis cache.
Minor boost. But slightly helps:
[ssh_connection] retries=3 pipelining=True
Major boost, but not very stable, often causes troubles. Putting more than 20 makes Ansible quite unstable.
[default] forks = 10
This config works pretty well to me:
[defaults] fact_caching = redis fact_caching_timeout = 86400 fact_caching_connection = localhost:6379:0 gathering = smart host_key_checking = False timeout = 20 retry_files_save_path = /home/ansible/retry/ forks = 10 log_path=/var/log/ansible.log [ssh_connection] retries=3 pipelining=True