In the earlier chapters, we explored various facts and functions that Puppet provides out-of-the-box. You may recall that, in Chapter 3, My First Puppet Module, we created a variable called $fact_list
(line 3 in the webapp
class), and we used it to store values of facts $::ipaddress_eth1
and $::uptime
. These two facts are built into Puppet. Once we declared the $fact_list
variable, we created a file
resource with the content
attribute that used the template
function (line 7 in the webapp
class) to populate the content of the file. The template
function is a commonly used function that comes bundled with Puppet.
When you start using Puppet on a regular basis, you soon realize that the built-in facts and functions may not be sufficient to build configurations you want to build. Luckily, custom facts and functions are quick and easy to write yourself.
This chapter will focus on how to extend Puppet beyond the built-in functionality. We will learn how to create your...