As we saw in Chapter 5, , 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 you how to use recurse
and another parameter, sourceselect
, to extend our previous example.
Modify the admin
user example as follows:
- Remove the
$dotfiles
parameter and remove the condition based on$dotfiles
. Add a second source to the home directory file resource:
define admin_user ( String $key, Enum['ssh-rsa','ssh-ed25519'] $keytype, ) { $username = $name user { $username: ensure => present, } file { "/home/${username}/.ssh": ensure => directory, mode => '0700', owner => $username, group => $username, require => File["/home/${username}"], } ssh_authorized_key { "${username}_key": key => $key, type => "$keytype",...