(How) do folks handle situations where puppet variables need to be populated from dynamic database queries? -- 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 Jan 6, 10:25 am, Jeff Sussna <j...@ingineering.it> wrote:> (How) do folks handle situations where puppet variables need to be > populated from dynamic database queries?Most folks do not. However, some have spawned a framework called hiera. By default, hiera uses a yaml backend but it can certainly be extended to query a database. In fact, I believe a mongo backend is out there somewhere. Of course, if you wanted, you could even write a custom function for the job. Hiera is probably a cleaner direction 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.
You can look into creating custom functions in ruby to pull back the data. Additionally you could create the manifests in ruby dsl. On Fri, Jan 6, 2012 at 10:25 AM, Jeff Sussna <jes@ingineering.it> wrote:> (How) do folks handle situations where puppet variables need to be > populated from dynamic database queries? > > -- > 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.
Nigel Kersten
2012-Jan-07 16:57 UTC
Re: [Puppet Users] Re: Database calls in puppet manifests
On Fri, Jan 6, 2012 at 8:45 AM, windowsrefund <windowsrefund@gmail.com>wrote:> > > On Jan 6, 10:25 am, Jeff Sussna <j...@ingineering.it> wrote: > > (How) do folks handle situations where puppet variables need to be > > populated from dynamic database queries? > > Most folks do not. However, some have spawned a framework called > hiera. By default, hiera uses a yaml backend but it can certainly be > extended to query a database. In fact, I believe a mongo backend is > out there somewhere. > > Of course, if you wanted, you could even write a custom function for > the job. Hiera is probably a cleaner direction though. > >Another option is to use the generate() function on your master if you''ve already got a shell/executable script that can get the data for you. If you''ve got lots of these, it''s probably not the best approach, but it''s a lower barrier to entry if you''re only doing one or two. -- Nigel Kersten Product Manager, 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 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.
This sounds like a fine solution. I won''t have many, and easy enough to encapsulate the data access in a shell script, and it sounds like I can call generate directly from my template where I need the dynamic values. I may be getting greedy, but if a value doesn''t change between runs, will Puppet be smart enough to know the file doesn''t need to be updated on the client? On Jan 7, 10:57 am, Nigel Kersten <ni...@puppetlabs.com> wrote:> On Fri, Jan 6, 2012 at 8:45 AM, windowsrefund <windowsref...@gmail.com>wrote: > > > > > On Jan 6, 10:25 am, Jeff Sussna <j...@ingineering.it> wrote: > > > (How) do folks handle situations where puppet variables need to be > > > populated from dynamic database queries? > > > Most folks do not. However, some have spawned a framework called > > hiera. By default, hiera uses a yaml backend but it can certainly be > > extended to query a database. In fact, I believe a mongo backend is > > out there somewhere. > > > Of course, if you wanted, you could even write a custom function for > > the job. Hiera is probably a cleaner direction though. > > Another option is to use the generate() function on your master if you''ve > already got a shell/executable script that can get the data for you. > > If you''ve got lots of these, it''s probably not the best approach, but it''s > a lower barrier to entry if you''re only doing one or two. > > -- > Nigel Kersten > Product Manager, 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 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.
Nigel Kersten
2012-Jan-09 21:18 UTC
Re: [Puppet Users] Re: Database calls in puppet manifests
On Mon, Jan 9, 2012 at 12:13 PM, Jeff Sussna <jes@ingineering.it> wrote:> This sounds like a fine solution. I won''t have many, and easy enough > to encapsulate the data access in a shell script, and it sounds like I > can call generate directly from my template where I need the dynamic > values. > > I may be getting greedy, but if a value doesn''t change between runs, > will Puppet be smart enough to know the file doesn''t need to be > updated on the client? >Yes. If you''re say using the database call to populate the contents of a text file, and that content does not change between runs, Puppet on the client will not update the file if the contents already match your desired state.> > > On Jan 7, 10:57 am, Nigel Kersten <ni...@puppetlabs.com> wrote: > > On Fri, Jan 6, 2012 at 8:45 AM, windowsrefund <windowsref...@gmail.com > >wrote: > > > > > > > > > On Jan 6, 10:25 am, Jeff Sussna <j...@ingineering.it> wrote: > > > > (How) do folks handle situations where puppet variables need to be > > > > populated from dynamic database queries? > > > > > Most folks do not. However, some have spawned a framework called > > > hiera. By default, hiera uses a yaml backend but it can certainly be > > > extended to query a database. In fact, I believe a mongo backend is > > > out there somewhere. > > > > > Of course, if you wanted, you could even write a custom function for > > > the job. Hiera is probably a cleaner direction though. > > > > Another option is to use the generate() function on your master if you''ve > > already got a shell/executable script that can get the data for you. > > > > If you''ve got lots of these, it''s probably not the best approach, but > it''s > > a lower barrier to entry if you''re only doing one or two. > > > > -- > > Nigel Kersten > > Product Manager, 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 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. > >-- Nigel Kersten Product Manager, 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 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.