I want to be able to add additional resources to my virtual users,
such as force a file or directory to exist if I realize that user, if
someone could point me in the right direction, I’m guessing i need to
use a definition I’m just not sure on the best way to do it. This is
what I have currently:

nodes.pp
node 'foo.bar.com' {
  include user::storageadmins
}

storageadmin.pp:
class user::storageadmins inherits user::virtual {
    realize(
        User["aguy"],
        User["agirl"]
    )
}

class user::virtual {
    @user { "aguy":
        ensure  => "present",
        uid     => "1001",
        gid     => "14",
        comment => "",
        home    => "/export/home/aguy",
        shell   => "/bin/bash",
    managehome => "true",
    }

    @user { "agirl":
        ensure  => "present",
        uid     => "1002",
        gid     => "14",
        comment => "",
        home    => "/export/home/agirl",
        shell   => "/bin/bash",
        managehome => "true",
    }

What I want to do is now force these users to create a home directory
and .ssh directory. I know managehome will initially create the home
directory, but if you remove it, it will not auto recreate it.

This is how I have done it with non-virtual users, but from what I
read I should be using virtual users instead of the way I am currently
doing it.

users.pp
class user_aguy {
    user { "aguy":
        gid => 'sysadmin',
        uid => '1001',
        comment => 'aguy',
        ensure => 'present',
        managehome => 'true',
        home => '/export/home/aguy',
        shell => '/bin/bash'
    }
    file { "/export/home/aguy":
        ensure => 'directory',
        require => User['mrk1207'],
        owner => 'mrk1207',
        group => 'sysadmin',
        mode => '700',
    }
    file { "/export/home/aguy/.ssh":
        ensure => 'directory',
        require => aguy,
        owner => 'aguy',
        group => 'sysadmin',
        mode => '700',
    }
}

groups.pp
class unix_team {
    include aguy
}

nodes.pp
node 'foo.bar.com' {
  include unix_team

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@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