On 28 Sep, 19:44, Eric Gerlach <[email protected]> wrote:
> You might be able to do something like:
>
> realize User[kenneth]
>
> User[kenneth] {
> groups => $server_type ? {
> typeA => "wheel",
> default => undef,
> }
>
> }
>
> to realize it the way you want. Haven't tried anything like that though.
> Maybe someone else can comment if it works.
I have tried this:
node 'mynode.local' {
$server_type = "webserver"
adduser { "joe":
server_type => $server_type,
user_name => "joe",
}
}
define adduser ( $user_name, $server_type ) {
realize User[$user_name]
realize Group[$user_name]
User[$user_name] {
groups => $server_type ? {
webserver => wheel,
default => $user_name,
},
}
}
@group { "joe":
ensure => present,
gid => 1234,
allowdupe => false
}
@user {"joe":
ensure => present,
managehome => true,
uid => 1234,
gid => 1234,
home => "/home/joe",
shell => "/bin/bash",
comment => "Joe",
password => '$1$ij21Zc04$MwyqTQP2fXc0BqMIjtz5b/',
}
When running puppetd on mynode.local I get this message:
notice: Ignoring cache
err: Could not retrieve catalog: Only subclasses can override
parameters at /etc/puppet/manifests/classes/adduser.pp:11
warning: Not using cache on failed catalog
Best regards,
Erling Ringen Elvsrud
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---