Distributing and merging directory trees
As we saw in the previous chapter, the file resource has a recurse
parameter, which allows Puppet to transfer entire directory trees. We used this parameter to copy an admin user's dotfiles into their home directory. In this section, we'll show how to use recurse
and another parameter sourceselect
to extend our previous example.
How to do it...
Modify our admin user example as follows:
- Remove the
$dotfiles
parameter, remove the condition based on$dotfiles
. Add a second source to the home directoryfile
resource:define admin_user ($key, $keytype) { $username = $name user { $username: ensure => present, } file { "/home/${username}/.ssh": ensure => directory, mode => '0700', owner => $username, group ...
Get DevOps: Puppet, Docker, and Kubernetes 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.