Users tend to customize their shell environments, terminal colors, aliases, and so forth. This is usually achieved by a number of dotfiles
in their home
directory, for example, .bash_ profile
or .vimrc
.
You can use Puppet to synchronize and update each user's dotfiles
across a number of machines by extending the virtual user setup we have developed throughout this chapter. We'll start a new module, dmin_user
, and use the file type's recurse
attribute to copy files into each user's home
directory.
Here's what you need to do:
- Create the
admin_user
defined type (define admin_user
) in themodules/admin_user/manifests/init.pp
file, as follows:
define admin_user ( String $key, Enum['ssh-rsa','ssh-ed25519'] $keytype, String $dotfiles = false, ) { user { $name: ensure => present, } file { "/home/${name}/.ssh": ensure => directory, mode => '0700', owner => "$name", require => File["/home/...