Using certain options already improved speed for ansible. Gathering facts is still something that can consume some extra time. In order to improve this on a lot of machines if you use them often is to cache the facts. On the original docs they suggest that you install redis. On ubuntu that would be redis-server. Don’t forget to install the redis python module as such.
pip install redis
Then you would have to add the settings to ansible.cfg in the default section.
gathering = smart fact_caching = redis fact_caching_timeout = 86400
Only to find out that you get an error back
File "/usr/local/lib/python2.7/dist-packages/redis/connection.py", line 574, in read_response raise response redis.exceptions.ResponseError: NOAUTH Authentication required.
Turns out as also stated on the documentation that port/password is not yet supported. Although i did find a page that uses a host/port in the config for ansible.cfg.
Anyways, edit your redis.conf file and find the word “requirepass” and comment it out. Restart redis after it.
And there you go, error resolved 🙂
For reference on the gathering option in ansible:
# smart - gather by default, but don't regather if already gathered # implicit - gather by default, turn off with gather_facts: False # explicit - do not gather by default, must say gather_facts: True