Hi list, I wondered if I could include ''dynamic'' data inside a hiera yaml file. I would like to be able to add variables in scope of the resource which performs a hiera call. So e.g. in hiera yaml: address: "192.168.1.#{nodeID}" in puppet node test { $nodeID = 5 $ip=hiera(address) } Is such thing possible and if so what is the correct syntax? thanks Peter -- 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.
----- Original Message -----> From: "Peter De Cleyn" <peter@decleyn.net> > To: puppet-users@googlegroups.com > Sent: Wednesday, October 17, 2012 3:24:30 PM > Subject: [Puppet Users] dynamic data in hiera > > Hi list, > > I wondered if I could include ''dynamic'' data inside a hiera yaml > file. I would like to be able to add variables in scope of the > resource which performs a hiera call. So e.g. > > in hiera yaml: > > address: "192.168.1.#{nodeID}"try %{nodeID} -- 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.
thx! that works! However, in testing just now I bumped against something strange. When I add %{$nodeID} (which I should not), the CPU usage of the puppet master shoots to 100% and stays there. The client will eventually time out (execution expired) and the puppet master keeps burning CPU cycles. This is a test setup up, so no other nodes are connected but one and it is quite reproducable on this setup. Is this a known issue? Peter Op woensdag 17 oktober 2012 16:30:03 UTC+2 schreef R.I. Pienaar het volgende:> > > > ----- Original Message ----- > > From: "Peter De Cleyn" <pe...@decleyn.net <javascript:>> > > To: puppet...@googlegroups.com <javascript:> > > Sent: Wednesday, October 17, 2012 3:24:30 PM > > Subject: [Puppet Users] dynamic data in hiera > > > > Hi list, > > > > I wondered if I could include ''dynamic'' data inside a hiera yaml > > file. I would like to be able to add variables in scope of the > > resource which performs a hiera call. So e.g. > > > > in hiera yaml: > > > > address: "192.168.1.#{nodeID}" > > try %{nodeID} >-- 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/-/uoayA6QJge8J. 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.
i have the same problem with cpu... You are using stororeconfigs? Douglas Brancaglion 2012/10/17 pdcleyn <peter.decleyn@gmail.com>> thx! that works! > > However, in testing just now I bumped against something strange. When I > add %{$nodeID} (which I should not), the CPU usage of the puppet master > shoots to 100% and stays there. The client will eventually time out > (execution expired) and the puppet master keeps burning CPU cycles. This is > a test setup up, so no other nodes are connected but one and it is quite > reproducable on this setup. Is this a known issue? > > Peter > > > Op woensdag 17 oktober 2012 16:30:03 UTC+2 schreef R.I. Pienaar het > volgende: > >> >> >> ----- Original Message ----- >> > From: "Peter De Cleyn" <pe...@decleyn.net> >> > To: puppet...@googlegroups.com >> > Sent: Wednesday, October 17, 2012 3:24:30 PM >> > Subject: [Puppet Users] dynamic data in hiera >> > >> > Hi list, >> > >> > I wondered if I could include ''dynamic'' data inside a hiera yaml >> > file. I would like to be able to add variables in scope of the >> > resource which performs a hiera call. So e.g. >> > >> > in hiera yaml: >> > >> > address: "192.168.1.#{nodeID}" >> >> try %{nodeID} >> > -- > 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/-/uoayA6QJge8J. > > 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. >-- Douglas Brancaglion Security Analist -- 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.
No, just plain manifests and hiera yaml files. Peter On 17 Oct 2012, at 19:36, Douglas Brancaglion <douglas.reader@gmail.com> wrote:> i have the same problem with cpu... > > You are using stororeconfigs? > > Douglas Brancaglion > 2012/10/17 pdcleyn <peter.decleyn@gmail.com> > thx! that works! > > However, in testing just now I bumped against something strange. When I add %{$nodeID} (which I should not), the CPU usage of the puppet master shoots to 100% and stays there. The client will eventually time out (execution expired) and the puppet master keeps burning CPU cycles. This is a test setup up, so no other nodes are connected but one and it is quite reproducable on this setup. Is this a known issue? > > Peter > > > Op woensdag 17 oktober 2012 16:30:03 UTC+2 schreef R.I. Pienaar het volgende: > > > ----- Original Message ----- > > From: "Peter De Cleyn" <pe...@decleyn.net> > > To: puppet...@googlegroups.com > > Sent: Wednesday, October 17, 2012 3:24:30 PM > > Subject: [Puppet Users] dynamic data in hiera > > > > Hi list, > > > > I wondered if I could include ''dynamic'' data inside a hiera yaml > > file. I would like to be able to add variables in scope of the > > resource which performs a hiera call. So e.g. > > > > in hiera yaml: > > > > address: "192.168.1.#{nodeID}" > > try %{nodeID} > -- > 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/-/uoayA6QJge8J. > > 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. > > > > -- > Douglas Brancaglion > Security Analist > > -- > 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.
For further reference: I found the problem with the CPU burning. It seems hiera lookups can end up in an endless loop when specifying meaningful regex characters (like $,+,?) in your lookup variables. So specifying key:%{$var} will cause an endless loop. I created a ticket http://projects.puppetlabs.com/issues/17094 to address the issue and suggested a possible fix (using Regexp.escape) . Otherwise, hiera is a great tool to work with! Such a level of flexibility you add to your puppet environment! Peter On Wed, Oct 17, 2012 at 11:54 PM, Peter De Cleyn <peter.decleyn@gmail.com>wrote:> No, just plain manifests and hiera yaml files. > > Peter > > > On 17 Oct 2012, at 19:36, Douglas Brancaglion <douglas.reader@gmail.com> > wrote: > > i have the same problem with cpu... > > You are using stororeconfigs? > > Douglas Brancaglion > 2012/10/17 pdcleyn <peter.decleyn@gmail.com> > >> thx! that works! >> >> However, in testing just now I bumped against something strange. When I >> add %{$nodeID} (which I should not), the CPU usage of the puppet master >> shoots to 100% and stays there. The client will eventually time out >> (execution expired) and the puppet master keeps burning CPU cycles. This is >> a test setup up, so no other nodes are connected but one and it is quite >> reproducable on this setup. Is this a known issue? >> >> Peter >> >> >> Op woensdag 17 oktober 2012 16:30:03 UTC+2 schreef R.I. Pienaar het >> volgende: >> >>> >>> >>> ----- Original Message ----- >>> > From: "Peter De Cleyn" <pe...@decleyn.net> >>> > To: puppet...@googlegroups.com >>> > Sent: Wednesday, October 17, 2012 3:24:30 PM >>> > Subject: [Puppet Users] dynamic data in hiera >>> > >>> > Hi list, >>> > >>> > I wondered if I could include ''dynamic'' data inside a hiera yaml >>> > file. I would like to be able to add variables in scope of the >>> > resource which performs a hiera call. So e.g. >>> > >>> > in hiera yaml: >>> > >>> > address: "192.168.1.#{nodeID}" >>> >>> try %{nodeID} >>> >> -- >> 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/-/uoayA6QJge8J. >> >> 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. >> > > > > -- > Douglas Brancaglion > Security Analist > > -- > 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.
On Thursday, October 18, 2012 11:39:05 AM UTC-7, pdcleyn wrote:> > ... endless loop when specifying meaningful regex characters (like $,+,?) > in your lookup variables. > > >Oh! That''s probably exactly what happened when I was experimenting w/ interpolating members of hash and array vars received from Puppet. (i.e. testvalue: %{myhash[''some_key'']} ) -- 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/-/4jmQ_Rm5gd4J. 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.
To be sure, you can run the puppet master in debug mode: puppet master --no-daemonize --debug You will get a continuous stream of messages from hiera: Debug: hiera(): Looking up $sys in scope Debug: hiera(): Looking up $sys in scope Debug: hiera(): Looking up $sys in scope ... On Fri, Oct 19, 2012 at 1:16 AM, Nick Fagerlund < nick.fagerlund@puppetlabs.com> wrote:> > On Thursday, October 18, 2012 11:39:05 AM UTC-7, pdcleyn wrote: >> >> ... endless loop when specifying meaningful regex characters (like $,+,?) >> in your lookup variables. >> >> >> > Oh! That''s probably exactly what happened when I was experimenting w/ > interpolating members of hash and array vars received from Puppet. (i.e. > testvalue: %{myhash[''some_key'']} ) > > -- > 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/-/4jmQ_Rm5gd4J. > > 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.