Creating resources with Hiera data

When we started working with Puppet, we created resources directly in the manifest using literal attribute values. In this chapter, we've seen how to use Hiera data to fill in the title and attributes of resources in the manifest. We can now take this idea one step further and create resources directly from Hiera queries. The advantage of this method is that we can create any number of resources of any type, based purely on data.

Building resources from Hiera arrays

In Chapter 5, Variables, expressions, and facts, we learned how to use Puppet's each function to iterate over an array or hash, creating resources as we go. Let's apply this technique to some Hiera data. In our first example, we'll create some user ...

Get Puppet 5 Beginner's Guide - Third Edition 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.