From the course: Ansible: From Basics to Guru by Pearson

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Fact caching

Fact caching

In this video, we'll talk about fact caching, which is also plugin based. So after fact gathering, facts are kept in memory and they stay there for the duration of playbook execution. That can be very inefficient, because if you run playbooks that need facts a lot of times, you are gathering facts all the times, and that is why plugins can be used to enable fact caching. When using a plugin, facts should be gathered manually or a scheduled job that is executed after expiration of the fact cache. And then the facts will be serviced from the cache and you don't have to run fact gathering from every single playbook again. There is a disadvantage though. And this advantage is that for parameters that change rapidly, you'll be dealing with old information. Like memory usage, the fact that you had 4 GB of memory available an hour ago doesn't mean anything for the availability of your memory right now. Let's check out how it works. Okay so in order to configure FACT caching, we are going to…

Contents