Ansible: Boost Task Execution Speed

Improve SSH

  1. Gather facts
  2. Copy zipped playbook code to the node
  3. Execute the playbook code
[ssh_config]
pipelining = true

Run more tasks parallel

[defaults]
forks = 20

Use the “free” strategy

[defaults]
strategy = free

Disable or cache fact gathering

- name: playbook
gather_facts: false
[defaults]
gathering = explicit
[defaults]
gathering = smart
fact_caching_timeout = 86400
fact_caching = jsonfile
fact_caching_connection = ./ansible_fact_cache

Conclusion

[defaults]
strategy = free
forks = 20
[ssh_config]
pipelining = true
[defaults]
gathering = smart
fact_caching_timeout = 86400
fact_caching = jsonfile
fact_caching_connection = ./ansible_fact_cache

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store