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 - 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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Working with Puppet code6m 49s
-
(Locked)
Variables and conditionals6m 19s
-
(Locked)
Organize your code with classes3m 40s
-
(Locked)
Facts and functions4m 29s
-
(Locked)
Defined resource types2m 21s
-
(Locked)
Templates3m 51s
-
(Locked)
Challenge: Create a base node class30s
-
(Locked)
Solution: Create a base node class1m 46s
-
-
-
-
-