Adding the custom facts

We may also need custom facts. For example, when dealing with users, it is important to know the Windows users and make changes accordingly. We will start with a simple example that shows how to add a custom fact.

This example custom fact is a simple one. We will create a fact named firstfact and make its value Hello World!. We can add custom facts by modules. In a module structure, it adds the facts under the lib/facter folder. To remember where we put our custom facts, we will create a module named common and put all our facts in this folder. The name of the module is not important here and you can give it any name. For now, we will just use common. Here is the module structure:

We will put our custom fact definitions under ...

Get Learning Puppet for Windows Server now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.