On 2010-05-03 19:06, merritt wrote:
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.
A definition is a good way, yes. Like this:
define myuser($uid, $comment, ...)
{
user {
$name:
uid => $uid, comment => $comment, ...;
}
file {
"/home/$name":
ensure => directory, owner => $name, ...;
"/home/$name/.ssh":
ensure => directory, owner => $name, ...;
}
}
class our-users
{
@myuser { "aguy": uid => 1001, ...; }
@myuser { "agirl": uid => 1002, ...; }
@myuser { "analien": uid => 1003, ...; }
}
class storageadmins
{
include our-users
realize(User["aguy"], User["agirl"])
}
A slight modification is to declare if the user should be an admin
or not in the myuser definition. Add a parameter $type to myuser
(without actually using it inside the definition), and do:
class our-users
{
@myuser { "aguy": uid => 1001, type => "storageadmin", ...; }
@myuser { "agirl": uid => 1002, type => "storageadmin", ...; }
@myuser { "analien": uid => 1003, type => "nonadmin", ...; }
}
class storageadmins
{
include our-users
Myuser <| type == "storageadmin" |>
}
It's up to your taste to determine which version is preferable.
/Bellman
--
You received this message because you are subscribed to the Google Groups "Puppet
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.