Hi, I thinking about how I could use hiera and I cant work it out, so I would like to ask for some enlightenment. class a {... $x = hiera(''x'') ...} define a::b ( $x = hiera(''x'') {...} define a::c ( $x = hiera(''x'') {...} include a a::b { "b": } a::c { "c": } so I thought about a directory structure similar to the following, assuming the yaml backend for now. datadir/a/a::b/b.yaml datadir/a/a::c/c.yaml datadir/a/a.yaml to achieve this I would do something like this in hiera.yaml :hierarchy: - %{module_name}/%{XXX}/%{name} - %{module_name}/%{module_name} Question 1: What do I fill in for %{XXX} that it expands to ''a::b'' ''a::c'' ? And what if in addition I want to use the puppet backend? How do I specify defaults. For class a I can do class a::data { $x = ''bla'' } Question 2: But where would I specify defaults for a::b and a::c ? And Question 3, finally: Does it make sense to you what I am trying to do, actually? -- Kind Regards, Markus
Hi, On 02/23/2012 02:21 PM, Markus Falb wrote:> Does it make sense to you what I am trying to > do, actually?no. Not at that degree of obfuscation, at least ;-) -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. 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.
On Thu, Feb 23, 2012 at 5:21 AM, Markus Falb <markus.falb@fasel.at> wrote:> > And Question 3, finally: Does it make sense to you what I am trying to > do, actually?It feels significantly simpler for you to use hiera to pick out values that you then pass to instances of defines, rather than baking hiera into the definition of the define itself? Might be easier to give advice if you post what the defined types that you''re planning to do this with actually do though? -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. 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.
On 23.2.2012 15:52, Nigel Kersten wrote:> > > On Thu, Feb 23, 2012 at 5:21 AM, Markus Falb <markus.falb@fasel.at > <mailto:markus.falb@fasel.at>> wrote: > > > And Question 3, finally: Does it make sense to you what I am trying to > do, actually? > > > It feels significantly simpler for you to use hiera to pick out values > that you then pass to instances of defines, rather than baking hiera > into the definition of the define itself? > > Might be easier to give advice if you post what the defined types that > you''re planning to do this with actually do though?I want puppet managed phpmyadmin. phpmyadmin config has a global part and one part of the config for every db instance. So I thought I''d try define phpmyadmin::instance ( ... $extension = hiera(''mysql'') ) { file { "phpmyadmin instance $name": path => "/etc/phpMyAdmin/$name.instance.inc.php", content => template("phpmyadmin/instance.inc.php.erb"), } } Defaults should be set in a data class class phpmyadmin::instance::data { if $osfamily == ''RedHat'' { $extension = ''mysql'' } } Configuration values therefore could come from: 1. explicitly set in manifest 2. external set value, pulled in by hiera 3. default value set in phpmyadmin::instance::data class, pulled in by hiera (But hiera seems not to look. For the phpmyadmin class it looks in the phpmyadmin::data class) I am afraid of name clashes. If it came to me mind to indroduce a define phpmyadmin::instance::monitor (... = hiera(...)) {...} then I could have phpmyadmin::instance {''x'': ...} phpmyadmin::instance::monitor { ''x'': ...} How can I avoid that the phpmyadmin::instance::monitor is not looking in the yaml file for phpmyadmin::instance or vice versa? Thanks -- Kind Regards, Markus Falb