Managing users' customization files
Users, like cats, often feel the need to mark their territory. Unlike most cats, though, 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 .emacs
.
You can use Puppet to synchronize and update each user's dotfiles across a number of machines by extending the virtual user setup we've developed throughout this chapter.
How to do it…
Here's what you need to do:
Modify the
modules/user/manifests/virtual.pp
file as follows:class user::virtual { define user_dotfile($user) { $source = regsubst($name, "^/home/${user}/.(.*)$", "puppet:///modules/user/${user}-\\1") file { $name: source => $source, owner => $user, group => $user, } } define ssh_user($key,$dotfile='') { user { $name: ensure => present, managehome => true, shell => '/bin/bash...