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.

Using set_fact

Using set_fact

In this video, I will tell you about SetFact. So what is it? Well, SetFact is a module that you can use to define a fact from within a playbook. And the nice thing about SetFact is that your fact will get a global scope. Global scope, that means that it applies to everywhere in the playbook. After finishing the playbook run, however, the facts are not usable anymore, because they're not stored anywhere. Sounds easy. Let's check it out. So I would like to go to the documentation docs.ansible.com. I'm going there from the start, because if you miss it earlier, the documentation that you need is a little bit hidden. You need to select Ansible Core on the top, and then you select Ansible Core documentation. Otherwise, you get to a lot of stuff about Ansible Automation Platform. Nothing wrong with Ansible Automation Platform, but most likely it's not what you need. Use the version documentation that is closest to what you are using and then check it out. So set fact. And that is a module…

Contents