-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2011-11-28 16:01, Dan White wrote:

> In my users class, I want to be able to push out custom dot-files when
> the user account is first created.
> Unfortunately, if one sets user:managehome => true, the dotfiles are
> created by default and the custom file is not pushed out unless you set
> file:replace => yes.
> 
> The downside of this is that the dot-files would then have to be managed
> from the puppet-master, which, in this case, I would prefer to avoid.  I
> want to push the custom dot-files out the first time only.

(Late answer, I know, but anyway.)

So, make useradd(8) not copy out those files you want to manage.  Assuming
you want to give your users a specific .emacs file, something like this:

    class no_skel_dot_emacs
    {
        file {
            '/etc/skel/.emacs':
                ensure => absent,
                # We want this to happen *after* the /etc/skel/.emacs file
                # is installed by the Emacs package...
                require => Package['emacs-common'];
        }
    }

    define myuser($uid, $gecos)
    {
        include no_skel_dot_emacs

        user {
            $name:
                ensure => present, uid => $uid, $comment => $gecos,
                managehome => true,
                require => Class[no_skel_dot_emacs];
        }
        file {
            "/home/${name}/.emacs":
                ensure => file, replace => no,
                content => template('.../dot-emacs.erb'),
                owner => $name, group => $name, mode => 0644;
        }
    }

If /etc/skel/.emacs doesn't exist when useradd is run, it won't be copied
out to the user's home directory, and you won't have a conflict.


        /Bellman
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAk8EdTEACgkQDGpP8Cv3aqLCJQCfVwdX2zSzhaIxschELYv7xzY8
MpsAoIIbhO60x+AuZdats8cFIKlOdR8S
=5COp
-----END PGP SIGNATURE-----

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to