hi, we''re currently evaluating hiera to get rid of hordes of global variables and prepare our manifests for next iteration of puppet. now, we have some variables, used by classes, which set properties based on facts, ie. we set approperiate interface address which should be used on monitoring server, ie: $nagiosip = $ipaddress_bond0_1234 now, we can convert it to: class { "nagios::host": ip => $ipaddress_bond0_1234 } but... we''ll need to include this on every single node (now we use node inheritance and just set $nagiosip on top node level for group of hosts that share the same vlan). is it possible to achieve the same thing with hiera (then we could just set default parameter of nagios::host class to hiera)? we''re currently evaluating yaml backend, puppet backend is not as easy to understand to me and i''m not sure if we can mix both (ie. define separate calling_modules and search hierarchies for both). -- 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/-/IhWZNvwQQNgJ. 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 07/20/2012 03:55 PM, asq wrote:> > class { "nagios::host": ip => $ipaddress_bond0_1234 } > > but... we''ll need to include this on every single node (now we use node > inheritance and just set $nagiosip on top node level for group of hosts > that share the same vlan).This end could be trivially met by putting this class declaration in a scope that is present for all your nodes. Perhaps a "default" class or similar. The class parameter should be assigned directly from hiera. Failing that, just assign a "nagiosip" value in hiera an put a class { "nagios::host": ip => hiera("nagiosip") } in your global scope. -- 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.
W dniu poniedziałek, 23 lipca 2012 09:21:09 UTC+2 użytkownik Felix.Frank napisał:> > This end could be trivially met by putting this class declaration in a > scope that is present for all your nodes. Perhaps a "default" class or > similar. > > The class parameter should be assigned directly from hiera. Failing > that, just assign a "nagiosip" value in hiera an put a > > class { "nagios::host": ip => hiera("nagiosip") } > > in your global scope. >i don''t want to define nagiosip - it should be inherited from fact (current set IP address on given node). ie. project A: $nagiosip = $ipaddress_bond0_1234 project B: $nagiosip = $ipaddress_bond0_1235 project C: $nagiosip = $ipaddress_eth2 project D: $nagiosip = $ipaddress_bond0_555 in our current setup we have: class baseclass { # this is class mandatory for every production node . . include nagios::host } node projectA { # production vlan for projectA is 1234 $nagiosip = $ipaddress_bond0_1234 } node foo inherits projectA { include baseclass } can we do that without global variables? -- 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/-/sG5AHi_z4nAJ. 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 07/23/2012 11:59 AM, asq wrote:> i don''t want to define nagiosip - it should be inherited from fact > (current set IP address on given node). ie. > project A: $nagiosip = $ipaddress_bond0_1234 > project B: $nagiosip = $ipaddress_bond0_1235 > project C: $nagiosip = $ipaddress_eth2 > project D: $nagiosip = $ipaddress_bond0_555This is what I meant, sort of. Your hiera stores will probably have a "project" hierarchy layer. What you want to do is add a "vlan" value to this layer. Each node can lookup hiera("vlan") then, e.g. $vlan = hiera("vlan"). In your baseclass (or nagios::host class proper), you can retrieve the IP e.g. via inline_template("<%= scope.lookupvar(''ipaddress_bond0_''+vlan) %>") (code is untested) HTH Felix -- 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.