On Wednesday, July 18, 2012 6:13:11 PM UTC-5, Arun S A G wrote:
>
> Hi,
>
> I am trying to create multiple users using puppet. I have created a ENC
> and trying to use class wrapped defined types with create_resources
> function. For some reason things are falling apart. I would really
> appreciate some help on these
>
> Here are the details about my classes and configuration
> http://serverfault.com/questions/409001/create-resources-function-and-puppet-enc
>
>
There are at least three kinds of problems there:
1. resource names in resource references should be capitalized. For
example:
"require => [ User[$uname] ]"
2. you are trying to pass parameters (jeckman, saga, sandipb, and
vartika) to non-parametrized class 'users'.
3. your class 'users' is passing a previously-undefined variable $users
to the create_resources function
The quickest fix to get this working would probably be to add a parameter
$users to class users, and to update your ENC to wrap the individual user
hashes ('jeckman', etc.) in an outer hash 'users':
classes:
users:
users:
jeckman:
comment: Jack
gid: 100
[...]
That says class "users" should be assigned to the node, and the value of
its parameter "users" should be the specified hash of hashes.
With that said, I have to add that you probably should not be fiddling with
an ENC as you first start out. Small sites rarely get much advantage from
an ENC, and few indeed are the sites that will benefit from a custom-built
one. Additionally, I generally advise everyone to avoid parametrized
classes. They introduce pitfalls that newbies generally are not equipped
to recognize or appreciate.
If you want to define data, such as user properties, outside your Puppet
manifests then do look into adding Hiera to your puppetmaster. That's
Puppetlabs chosen direction. With hiera you use a Puppet function to load
your data instead of feeding it in via a parameter. (Puppet 3 will allow
you to combine class parameters with data lookup, but it's not quite ready
for release yet.)
John
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/puppet-users/-/i2EbtMyf-9oJ.
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.