Puppet 4: Working with Files and Templates
In this course, you will learn how to refactor your Puppet code to make use of templates, reduce the required files for a module, as well as how you can deliver parts of files, files, or complete sub-directories with Puppet.
What you'll learn
There are many scenarios where adding functionality to your Puppet modules can make your work easier. In this course, Puppet 4: Working with Files and Templates, you'll learn how to make use of templates in your Puppet code and how you can deliver files with Puppet. First, you'll see how easily you can reduce the number of files a module requires by making use of variable data and templates. The original template language was Ruby, but now with Puppet 4 you can support both Ruby and Puppet templates. Next, you'll look at ways to deliver files and parts of files. Finally, you'll learn how you can deliver a complete folder structure if required, purging any unmanaged content using file-line while concat delivers single lines or fragments of files allowing for autonomous edits to the managed files. By the end of the course, you will be able to create Puppet modules delivering configurations using templates, as well as allowing autonomous edits using file fragments.
Table of contents
- Working with ERB Templates 3m
- Creating the Templates Directory 4m
- Creating a Simple ERB Template 5m
- Understanding How to Make Use of Templates 4m
- Using ERB Templates Within the Module 8m
- Using Ruby IF Statements to Allow for Optional Configuration 6m
- Using Ruby Iterators with Arrays 9m
- Validating ERB Templates 4m
- Summary and What's Next 4m