On Friday 02 October 2009 07:35:57 Erling wrote:
> 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 should try re-organizing this so that you have your resources (here users)
defined in a class, e.g.
class all_users {
@user {"joe":
ensure => present,
...
groups => $servertype ? {
webserver => wheel,
default => $user_name
}
}
}
node 'mynode.local' {
$server_type = "webserver"
incldue all_users
}
This is a simpliest example, you may still use a define and have to watch out
for scoping rules, but that's the general idea.
Regards,
--
Michael Gliwinski
Henderson Group Information Services
9-11 Hightown Avenue, Newtownabby, BT36 4RT
Phone: 028 9034 3319
**********************************************************************************************
The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee and access to the email by anyone else
is unauthorised.
If you are not the intended recipient, any disclosure, copying, distribution or
any action taken or omitted to be taken in reliance on it, is prohibited and
may be unlawful.
When addressed to our clients, any opinions or advice contained in this e-mail
are subject to the terms and conditions expressed in the governing client
engagement leter or contract.
If you have received this email in error please notify
[email protected]
John Henderson (Holdings) Ltd
Registered office: 9 Hightown Avenue, Mallusk, County Antrim, Northern Ireland,
BT36 4RT.
Registered in Northern Ireland
Registration Number NI010588
Vat No.: 814 6399 12
*********************************************************************************
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---