Puppet facts
Facts are structured data about the system that we can use anywhere in our manifests. They are imported to the Puppet parser as top scope variables. To display the facts of a host, we can use the facter
command. We can write the command as follows to display the host-specific facts in each host's Command Prompt:
C:\>facter -p
In the following screenshot, we can see a sample output of the command. As we can see, there are many details such as architecture, domain, OS version, interfaces, and IP addresses:
Another easier way to look at the facts is by using our Foreman interface. In the top menu, go to Hosts | All Hosts and select the relevant host that you want to check out. Now, click the Facts button and you can see the following details:
As you can see in the following screenshot, we have the facts of a host again:
Using the facts in manifests
After learning how to display the facts, now let's continue with how to use them. In our example, we will change our firewallon
module...