Hi Martin, no currently only for the tomcat::instances. we currently change our modules to hiera, so maybe i find other cases.
rgds Florian Am Freitag, 16. März 2012 09:03:44 UTC+1 schrieb mawi: > > Hi Florian, > Interesting post. I was planning the same sort of approach for apache > vhosts with hiera and create_resources. This is good proof that the > idea works. > > Are you using this approach in other modules as well, if so which? > > Regards, > > Martin > > 2012/3/16 Gary Larizza <[email protected]>: > > Ahh, > > > > Good catch - thanks for replying back with the fix > > > > -Gary > > > > > > On Fri, Mar 16, 2012 at 7:58 AM, Florian Koch > > <[email protected]> wrote: > >> > >> 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. > >> > >> But i have found better solution, i use create_resources to build the > >> defines, works really smart > >> > >> > >> class tomcat::instance{ > >> > >> $instances = hiera('tomcat_instances') > >> > >> create_resources('tomcat::installer',$instances) > >> } > >> define tomcat::installer ($user,$group,$basedir,$logdir,$name){ ....} > >> --- > >> tomcat_instances: > >> crowd1: > >> name: 'cr1' > >> > >> basedir: '/srv' > >> logdir: '/var/log' > >> user: 'crowd' > >> group: 'crowd' > >> > >> crowd2: > >> name: 'cr2' > >> > >> basedir: '/srv' > >> logdir: '/var/log' > >> user: 'crowd' > >> group: 'crowd' > >> > >> > >> rgds Florian > >> Am Donnerstag, 15. März 2012 21:33:17 UTC+1 schrieb Gary Larizza: > >>> > >>> 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. > >>> > >>> On Fri, Mar 16, 2012 at 6:47 AM, Florian Koch > >>> <[email protected]> wrote: > >>>> > >>>> Hi, > >>>> > >>>> i have some trouble with hiera and %{calling_module}. > >>>> > >>>> 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' > >>>> ... > >>>> } > >>>> > >>>> i specify the tomcat names in a hiera file and run the define wit the > >>>> names as array (so they get executed for each name) > >>>> > >>>> '/var/lib/environments/test/hieradata'/tomcat/crowd.yaml > >>>> > >>>> --- > >>>> tomcat_instances: > >>>> - crowd1 > >>>> - crowd2 > >>>> > >>>> > >>>> crowd1: > >>>> name: 'crowd1' > >>>> basedir: '/srv' > >>>> logdir: '/var/log' > >>>> user: 'crowd' > >>>> group: 'crowd' > >>>> > >>>> crowd2: > >>>> name: 'crowd2' > >>>> basedir: '/srv' > >>>> logdir: '/var/log' > >>>> user: 'crowd' > >>>> group: 'crowd' > >>>> > >>>> my hiera.yaml > >>>> --- > >>>> :hierarchy: > >>>> - %{calling_module}/%{fqdn} > >>>> - %{hostbasename} > >>>> - %{domain} > >>>> - common > >>>> :backends: > >>>> - yaml > >>>> :yaml: > >>>> :datadir: '/var/lib/environments/%{environment}/hieradata' > >>>> > >>>> > >>>> if i wrote the crowd.yaml content in the common.yaml all works, if its > >>>> in the module subdirectory, puppet can not find the data from the > hiera > >>>> lookup in the tomcat::installer, but the call from the > tomcat::instance > >>>> class works, i get the right tomcat names in the error. > >>>> > >>>> any idea? > >>>> > >>>> rgds Florian > >>>> > >>>> -- > >>>> 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 [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. > >>> > >>> > >>> > >>> > >>> -- > >>> > >>> 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 [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. > > > > > > > > > > -- > > > > 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 [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. > > -- 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/-/tkX6nPJ1AvkJ. 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.
