In this recipe, we will outline how to set up and configure fact caching in Ansible. This is an important feature that can help us in optimizing and speeding the execution time of our playbooks when we require facts to be collected from our infrastructure.
- Update the ansible.cfg file to enable fact caching, and set up the required folder to store the cache:
< --- Output Omitted for brevity -->
- Create a new pb_get_facts.yml playbook to collect facts from the network using different approaches:
- name: Collect Network Facts
- name: Collect Facts Using Built-in Fact Modules