--
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/-/ZjdL5rHQxBYJ.
To post to this group, send email to puppet...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Am 15.03.2012 20:47, schrieb Florian Koch:
> i have some trouble with hiera and %{calling_module}.
i have had a similiar problem. You need to submit the values to the define.
> i have:
>
> class tomcat::instance{
> $instances = hiera('tomcat_instances')
> tomcat::installer{$instances:}
> }
>
> define tomcat::installer {
> require 'tomcat'
>
> $instance_opts = hiera($name)
> $tomcat_user = $instance_opts[user]
> $tomcat_group = $instance_opts[group]
> $basedir = $instance_opts[basedir]
> $logdir = $instance_opts[logdir]
> $tomcat_name = $instance_opts[name]
>
> $tomcat_version='6'
> ...
> }
You should try something like this:
class tomcat::instance {
$instances = hiera('tomcat_instances')
tomcat::installer { $instances[name]:
basedir => $instances[basedir],
logdir => $instances[logdir],
user => $instances[user],
group => $instances[group],
}
}
define tomcat::installer ($basedir, $logdir, $user, $group) {
...
}
I am using this method for my Icinga module
(http://github.com/dhoppe/puppet-icinga). You should take a look at the
following files:
- examples/icinga.yaml
- manifests/contact.pp
- manifests/contact/contacts.pp
Regards, Dennis
Hi Florian,
I believe since $calling_module is a variable out of Puppet and not Facter, that you will need to ALSO setup the Puppet backend, in addition to the YAML backend, in the hiera.yaml file so Hiera can get its value.
To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/c8Qv0i9cwEUJ.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
Are you using this approach in other modules as well, if so which?
Regards,
Martin
2012/3/16 Gary Larizza <ga...@puppetlabs.com>:
>>>> puppet-users...@googlegroups.com.
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/puppet-users?hl=en.
>>>
>>>
>>>
>>>
>>> --
>>>
>>> Gary Larizza
>>> Professional Services Engineer
>>> Puppet Labs
>>>
>> --
>> 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/-/c8Qv0i9cwEUJ.
>>
>> To post to this group, send email to puppet...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> puppet-users...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/puppet-users?hl=en.
>
>
>
>
> --
>
> Gary Larizza
> Professional Services Engineer
> Puppet Labs
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/puppet-users?hl=en.
>>>
>>>
>>>
>>>
>>> --
>>>
>>> Gary Larizza
>>> Professional Services Engineer
>>> Puppet Labs
>>>
>> --
>> 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/-/c8Qv0i9cwEUJ.
>>
>> To post to this group, send email to puppet...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> For more options, visit this group at
>> http://groups.google.com/group/puppet-users?hl=en.
>
>
>
>
> --
>
> Gary Larizza
> Professional Services Engineer
> Puppet Labs
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to puppet...@googlegroups.com.
> To unsubscribe from this group, send email to
Not neccessarily better in my mind because ..
> You should try something like this:
>
> class tomcat::instance {
> $instances = hiera('tomcat_instances')
>
> tomcat::installer { $instances[name]:
> basedir => $instances[basedir],
> logdir => $instances[logdir],
> user => $instances[user],
> group => $instances[group],
> }
> }
>
> define tomcat::installer ($basedir, $logdir, $user, $group) {
> ...
> }
.. this code is easier to explain and follow.
Not to be underestimated! :-)
Hi Gary,
hm for other classes it works , so i think the puppet backend is not needed
(https://github.com/ripienaar/hiera-puppet/commit/a7350529a99e5d1bad8b03749661f3f4c7f00216),
the problem is the define, i guess that a define won't set $module_path correct, the hiera cass from the class tocat::instance works perfect.