Hi, I'm trying to set up Puppet here for the first time and have run into
some problems.
To set up our users, I'm trying to define many users at once as virtual
resources for later realisation in sets. However, I'd like to have it
properly create the home directory:
@user { 'foo':
ensure => "present",
managehome => true,
home => $operatingsystem ? {
solaris => "/export/home/foo",
default => "/home/foo",
},
}
Now, this works; what I want to do is to make the 'foo' bit parameterised,
so that I can do:
$admins = [ 'foo', 'bar' ]
@user { $admins:
ensure => "present",
managehome => true,
home => $operatingsystem ? {
solaris => "/export/home/$name",
default => "/home/$name",
},
}
However this doesn't work; the $name is taken from the class that we're
running this in. Is there any way to do this? I'd use a loop over the
$admins list, except that I cant find any loop structures in the puppet
config language, only if/else.
I've tried using a define to do it:
define users::addVirt() {
@user { $name:
ensure => "present",
managehome => true,
home => $operatingsystem ? {
solaris => "/export/home/$name",
default => "/home/$name",
},
}
}
class users {
$admins = [ 'foo', 'bar' ]
users::addVirt { [ $admins ]: }
}
and this works; however when I later try to realise the users:
class users::admins inherits users {
$admingroup = $operatingsystem ? {
solaris => 'sysadmin',
default => 'unixadmin'
}
User[ $admins ] {
groups +> [ $admingroup ],
}
realize( User[ $admins ] )
}
I end up with:
err: Could not retrieve catalog from remote server: Error 400 on SERVER:
Only subclasses can override parameters at
/etc/puppet/manifests/classes/users.pp:96 on node
secpupprd01.its.auckland.ac.nz
which is complaining about the part:
User[ $admins ] {
groups +> [ $admingroup ],
}
although I cannot see why.
Does anyone have any advice for me on what is going wrong here, or a better
way to achieve this? Thanks in advance for any help...
Steve
Steve Shipway
University of Auckland ITS
UNIX Systems Design Lead
[email protected]
Ph: +64 9 373 7599 ext 86487
--
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.