Hi,
welcome to the list then.
On 12/19/2014 02:20 AM, Krushna Chandra Sahu wrote:
> In manifest folder, I have single file called init.pp
>
> class users (
>
> )
>
> {
> group { "nextadmin":
> ensure => present,
> }
>
> define users::add ( $username , $groupname = "" , $shell = "",
> $ensure , $login = ) {
> user { "$username":
> ensure => "$ensure" ,
> groups => "$groupname" ,
> shell => "$shell" ,
> require => Group["nextadmin"] ,
> }
> }
> }
>
First off, the define ... { } block should not be nested in the class
users { ... } block.
Create a manifests/add.pp file that holds only the define.
Verbs like "add" are misleading resource type names, for they imply an
action. You seldomly define actions in Puppet manifests. Instead, you
declare *state* that Puppet will manage for you. I suggest you go for
users::user or users::instance instead.
>
> Now to I have to create multiple user . Where and how to declare the
> username ,groupname etc in the same file ?
Once you have structured the manifests in a suitable fashion (as
described above), you can put this in a node { } block or any other
suitable manifest location:
users::user {
'jack':
ensure => present,
username => 'jack',
groupname => 'admins',
shell => '/bin/bash',
}
users::user {
'jill':
ensure => present,
username => 'jill',
groupname => 'operators',
shell => '/bin/bash',
}
HTH,
Felix
--
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/549A0A3D.10108%40Alumni.TU-Berlin.de.
For more options, visit https://groups.google.com/d/optout.