From the course: Learning Puppet

Unlock this course with a free trial

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

Facts and functions

Facts and functions - Puppet Tutorial

From the course: Learning Puppet

Facts and functions

When Puppet runs on a node, it first gathers a lot of information about the system using a program called Facter. That's Facter with an "er". If you have Puppet installed, you can actually run Facter yourself. It'll give you a lot of information about your system. Details about the operating system version, your processors, drives. To see the facts in the form in which they're available to Puppet, use the puppet facts command instead. This returns a structured hash of facts. Originally, Facter facts were just a flat list of values. For example, to get the 22 part of an Ubuntu v22.04 system, the fact name is $::operatingsystemmajrelease. The two colons at the beginning are optional, but they help to avoid confusion with a local variable of the same name. As you might have guessed, this led to a lot of frustrating typos. Puppet is now able to use structured data instead, so the same fact can now be accessed by using the built-in facts hash. There are a couple of nice things about this…

Contents