On 05/01/2011 01:05 PM, Denmat wrote:
> Hi,
>
> Sorry, just so I'm clear.
>
> You want create a user and a user group, and then add that user to an sshuser
> group?
>
> Can you create the user with all those groups by default? I don't see why it
> has to be so complicated unless you have something really specific you're
> trying to do.
>
> If you want to make it more complicated I would add something like:
>
> users.pp
> ....
> if Class[sshclassname] {
> $groups = "sshusers"
> ...
> groups => $groups
> ...
> }
>
> Where you would declare the ssh class for the node then test for the
> declaration when you create the user. You can also use a selector if you like.
>
> Not sure if this is best practice though, but easier than custom facts or
> execs.
Hi,
that would probably be
if defined(Class[...]) { }
though, which is hacky and prone to ordering problems - the group
membership will end up flapping.
What's needed here is class inheritance:
class default_user {
user { "defaultaccount": ... }
}
class default_user::ssh inherits default_user {
User["defaultaccount"] { groups +> "sshusers" }
}
Then the SSH class will include default_user::ssh. Done.
Notice the use of the "plusignment" syntax in the resource override.
HTH,
Felix
--
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.