On Wednesday, September 3, 2014 4:30:57 AM UTC-5, Tamás PAPP wrote:
>
> hi All,
>
>
> I have a manifest with this (the module was downloaded from github for
> generating known_hosts):
> define ...{
>
> [...things...]
>
> ## Ensure that all files and execs get the correct user/group
> combinations.
> Exec {
> user => $user,
> group => $user,
> require => File[$root],
> }
> File {
> ensure => $ensure ? { present => file, default => absent },
> owner => $user,
> group => $user,
> }
>
> }
>
>
>
> My problem is that group -> $user does not true in all cases.
Indeed. The code you downloaded is rather naive.
> Instead of
> this I would like to use the true values of the user.
>
> group should be something like
>
> $group = `id -ng` user
>
> group => $group,
>
>
> This obviously doesn't work. But what is the right solution?
> I am not master of puppets, but my guess is that I need a fact,
> however, facts look good only for system wide settings.
>
>
There are several viable solutions. I would favor putting your users and
groups under management, and keeping (user, group) relationships in your
external data. Then you could choose the correct group for any given user
by, say, looking up the username in a hash. Strictly speaking, it is not
mandatory in that case to put the users and groups under management, but
doing so makes sense if you are relying on anything about them, including
their existence. You then don't need to worry about how users and groups
initially *are*, which is comparatively hard to know, but rather on how
they *will be*, which would be easy to know.
John
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/2e26697b-04a6-47b9-8832-7a483ece92dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.