We''re working on prototpying facter+puppet for our environment and wondering what the generally accepted best-pratices are for handling hierarchical custom facts in facter. Right now, we''re using underscores. For example, if I''m collecting infromation about the raid array, it would be something like this: --- custom_hw_localstorage_ctrl_0_array_0_raid => 1 custom_hw_localstorage_ctrl_0_array_1_raid => 5 --- Where the implied hierachy is something like: custom hw localstorage ctrl 0: array 0: raid = 1 1: raid = 5 And of course, there would be many, many more sub-items under "custom", "hw", "localstorage", etc... I''m using the facter 2 and puppet 3 RCs and I know they have hiera included, but I''m not sure if or how that could help with this. Ultimately, I''d like to be able to use these facts for decision making in puppet. Thanks! -- 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/-/9Zy_zeh12owJ. 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.
Hi, On 07/16/2012 03:53 PM, ZJE wrote:> For example, if I''m collecting infromation about the raid array, it > would be something like this: > --- > custom_hw_localstorage_ctrl_0_array_0_raid => 1 > custom_hw_localstorage_ctrl_0_array_1_raid => 5 > --- > > Where the implied hierachy is something like: > custom > hw > localstorage > ctrl > 0: array > 0: raid = 1 > 1: raid = 5I believe that within the facter paradigm, this structure is as good as any. As far as I know, facter is supposed to support structured data such as arrays and hashes as fact values, but currently your workaround is probably the next best thing. Of course, accessing those dynamically will be quite an excercise, and probably not possible from the puppet DSL without resorting to inline templates. Cheers, 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.
Thanks for the reply, it really helps to know that I''m not missing something. I''m doing this mostly in a custom type, so something like Facter["custom_hw_localstorage_ctrl_#{ctrlid}_array_#{arrayid}_raid"].value does the trick. I''m imagining if I needed to do this at the manifest level the ruby DSL would help, but I haven''t tested it. On Fri, Jul 20, 2012 at 3:37 AM, Felix Frank wrote:> Hi, > > On 07/16/2012 03:53 PM, ZJE wrote: >> For example, if I''m collecting infromation about the raid array, it >> would be something like this: >> --- >> custom_hw_localstorage_ctrl_0_array_0_raid => 1 >> custom_hw_localstorage_ctrl_0_array_1_raid => 5 >> --- >> >> Where the implied hierachy is something like: >> custom >> hw >> localstorage >> ctrl >> 0: array >> 0: raid = 1 >> 1: raid = 5 > > I believe that within the facter paradigm, this structure is as good as any. > > As far as I know, facter is supposed to support structured data such as > arrays and hashes as fact values, but currently your workaround is > probably the next best thing. > > Of course, accessing those dynamically will be quite an excercise, and > probably not possible from the puppet DSL without resorting to inline > templates. > > Cheers, > 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. >-- 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.