Hi All, I''ve been trying to use Hiera for node classification, my sit.pp is simple: node default { hiera_include("classes") } which has been working well with simple class definitions like: user@host$ cat testagent.yaml 2012-06-18 14:55:48 jon pts/13 --- classes: - motd Is anyone doing this in production? I''ve seen a little about this on line but it seems to be mostly toy cases like the above. If so, is it possible to pass in parameterized classes this way, like: user@host$ cat openstackall.yaml 2012-06-18 14:56:01 jon pts/13 --- classes: - openstack::all: { public_address: %{ipaddress_eth0}, public_interface: eth0, private_interface: eth1, admin_email: nobody@csail.mit.edu, admin_password: admin_password, keystone_admin_token: keystone_admin_token, nova_user_password: nova_user_password, glance_user_password: glance_user_password, rabbit_password: rabbit_password, rabbit_user: rabbit_user, libvirt_type: kvm, fixed_range: 10.0.0.0/24 } The above doesn''t work, probably because I''m simply using the wrong structure... Thanks, -Jon ps if you saw this on the -dev list, mea culpa, auto complete misfire reposting here where it belongs.... -- 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/-/95mnxivvFNwJ. 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.
Nick Fagerlund
2012-Jun-18 20:23 UTC
[Puppet Users] Re: using hiera for node classification
On Monday, June 18, 2012 12:18:51 PM UTC-7, jon wrote:> > If so, is it possible to pass in parameterized classes this way, like: > > user@host$ cat openstackall.yaml 2012-06-18 14:56:01 jon pts/13 > --- > classes: > - openstack::all: { > public_address: %{ipaddress_eth0}, > public_interface: eth0, > private_interface: eth1, > admin_email: nobody@csail.mit.edu, > admin_password: admin_password, > keystone_admin_token: keystone_admin_token, > nova_user_password: nova_user_password, > glance_user_password: glance_user_password, > rabbit_password: rabbit_password, > rabbit_user: rabbit_user, > libvirt_type: kvm, > fixed_range: 10.0.0.0/24 } > > >Alas, no -- it really is just calling the "include" function, which doesn''t handle class parameters. YOUR OPTIONS: In puppet 3.0, "include" will automatically do a heira lookup of any class parameters you omit, which means you can give the list of classes to hiera_include and then specify class parameters right below. (like class::parameter1: "value" class::parameter2: "value") OR You could use the "create_resources" function to do what you want today. Just have to modify the yaml slightly, because you want a hash of hashes: --- classes: example::test: parameter1: value1 openstack::all: public_address: %{ipaddress_eth0} public_interface: eth0 private_interface: eth1 admin_email: nobody@csail.mit.edu admin_password: admin_password keystone_admin_token: keystone_admin_token nova_user_password: nova_user_password glance_user_password: glance_user_password rabbit_password: rabbit_password rabbit_user: rabbit_user libvirt_type: kvm fixed_range: 10.0.0.0/24 Then, in your manifest: create_resources( ''class'', hiera(''classes'') ) See here: http://docs.puppetlabs.com/references/latest/function.html#createresources -- 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/-/tsMyQ_Zc7OkJ. 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.