Michael Dodwell
2011-May-04 02:04 UTC
[Puppet Users] chicken and the egg.. pushing custom facter plugins for use within puppet..
Hi, I''ve created a number of custom facts that i''ve added to manifests. If i add the custom fact, have puppet push the custom fact file to the host, then after it''s pushed it add it to the templates everything works fine. However if i try and use the module on a fresh host without the custom facter it fails. When it looks at the templates it isn''t aware of the custom fact yet and errors out. How can i get it to pull down the facter plugin before it tries to read the template file? I have tried: file { "/etc/somefile": owner => root, group => root, mode => 644, require => File["/usr/lib/ruby/1.8/facter/custom_fact.rb"], content => template("module/etc/somefile"); } Any suggestions? I''d prefer not to have to add the custom facter to the kickstart/jumpstart enviroment. --MD -- 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.
Nan Liu
2011-May-04 03:04 UTC
Re: [Puppet Users] chicken and the egg.. pushing custom facter plugins for use within puppet..
On Tue, May 3, 2011 at 10:04 PM, Michael Dodwell <michael.dodwell@gmail.com> wrote:> Hi, > > I''ve created a number of custom facts that i''ve added to manifests. If > i add the custom fact, have puppet push the custom fact file to the > host, then after it''s pushed it add it to the templates everything > works fine. However if i try and use the module on a fresh host > without the custom facter it fails. When it looks at the templates it > isn''t aware of the custom fact yet and errors out. > > How can i get it to pull down the facter plugin before it tries to > read the template file? > > I have tried: > > file { > "/etc/somefile": > owner => root, > group => root, > mode => 644, > require => File["/usr/lib/ruby/1.8/facter/custom_fact.rb"], > content => template("module/etc/somefile"); > } > > Any suggestions? I''d prefer not to have to add the custom facter to > the kickstart/jumpstart enviroment.This is solved with pluginsync option. Puppet will download any custom facts/providers, so you should not distribute them to the agent as file resources. Thanks, Nan -- 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.
Disconnect
2011-May-04 14:01 UTC
Re: [Puppet Users] chicken and the egg.. pushing custom facter plugins for use within puppet..
Although good advice (pluginsync is win) that still doesn''t solve the chicken/egg problem - puppet won''t evaluate the new facts on the first run. We work around it by checking the existence of the fact/value before using it. Not ideal but it works. (And on brand new hosts, we run puppetd -t --tags no_such_tag to get the sync done. We actually do it twice, so that the new values are pushed up to the puppetmaster before the ''real'' run, but that probably isn''t strictly necessary.) On Tue, May 3, 2011 at 11:04 PM, Nan Liu <nan@puppetlabs.com> wrote:> On Tue, May 3, 2011 at 10:04 PM, Michael Dodwell > <michael.dodwell@gmail.com> wrote: > > Hi, > > > > I''ve created a number of custom facts that i''ve added to manifests. If > > i add the custom fact, have puppet push the custom fact file to the > > host, then after it''s pushed it add it to the templates everything > > works fine. However if i try and use the module on a fresh host > > without the custom facter it fails. When it looks at the templates it > > isn''t aware of the custom fact yet and errors out. > > > > How can i get it to pull down the facter plugin before it tries to > > read the template file? > > > > I have tried: > > > > file { > > "/etc/somefile": > > owner => root, > > group => root, > > mode => 644, > > require => File["/usr/lib/ruby/1.8/facter/custom_fact.rb"], > > content => template("module/etc/somefile"); > > } > > > > Any suggestions? I''d prefer not to have to add the custom facter to > > the kickstart/jumpstart enviroment. > > This is solved with pluginsync option. Puppet will download any custom > facts/providers, so you should not distribute them to the agent as > file resources. > > Thanks, > > Nan > > -- > 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.
Nan Liu
2011-May-04 14:12 UTC
Re: [Puppet Users] chicken and the egg.. pushing custom facter plugins for use within puppet..
On Wed, May 4, 2011 at 10:01 AM, Disconnect <dc.disconnect@gmail.com> wrote:> Although good advice (pluginsync is win) that still doesn''t solve the > chicken/egg problem - puppet won''t evaluate the new facts on the first run.Pluginsync should occur before facter executes and facts get submitted to the server, so it should not be necessary to run puppet twice. Any more info about your puppet version and system setup?> We work around it by checking the existence of the fact/value before using > it. Not ideal but it works. (And on brand new hosts, we run puppetd -t > --tags no_such_tag to get the sync done. We actually do it twice, so that > the new values are pushed up to the puppetmaster before the ''real'' run, but > that probably isn''t strictly necessary.) > > On Tue, May 3, 2011 at 11:04 PM, Nan Liu <nan@puppetlabs.com> wrote: >> >> On Tue, May 3, 2011 at 10:04 PM, Michael Dodwell >> <michael.dodwell@gmail.com> wrote: >> > Hi, >> > >> > I''ve created a number of custom facts that i''ve added to manifests. If >> > i add the custom fact, have puppet push the custom fact file to the >> > host, then after it''s pushed it add it to the templates everything >> > works fine. However if i try and use the module on a fresh host >> > without the custom facter it fails. When it looks at the templates it >> > isn''t aware of the custom fact yet and errors out. >> > >> > How can i get it to pull down the facter plugin before it tries to >> > read the template file? >> > >> > I have tried: >> > >> > file { >> > "/etc/somefile": >> > owner => root, >> > group => root, >> > mode => 644, >> > require => File["/usr/lib/ruby/1.8/facter/custom_fact.rb"], >> > content => template("module/etc/somefile"); >> > } >> > >> > Any suggestions? I''d prefer not to have to add the custom facter to >> > the kickstart/jumpstart enviroment. >> >> This is solved with pluginsync option. Puppet will download any custom >> facts/providers, so you should not distribute them to the agent as >> file resources. >> >> Thanks, >> >> Nan >> >> -- >> 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. >-- 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.
Michael Dodwell
2011-May-05 04:44 UTC
[Puppet Users] Re: chicken and the egg.. pushing custom facter plugins for use within puppet..
> We work around it by checking the existence of the fact/value before using itIs this done in the template file or somewhere else? Can you please supply dummy code as an example? Thanks On May 5, 12:01 am, Disconnect <dc.disconn...@gmail.com> wrote:> Although good advice (pluginsync is win) that still doesn''t solve the > chicken/egg problem - puppet won''t evaluate the new facts on the first run. > > We work around it by checking the existence of the fact/value before using > it. Not ideal but it works. (And on brand new hosts, we run puppetd -t > --tags no_such_tag to get the sync done. We actually do it twice, so that > the new values are pushed up to the puppetmaster before the ''real'' run, but > that probably isn''t strictly necessary.) > > > > > > > > On Tue, May 3, 2011 at 11:04 PM, Nan Liu <n...@puppetlabs.com> wrote: > > On Tue, May 3, 2011 at 10:04 PM, Michael Dodwell > > <michael.dodw...@gmail.com> wrote: > > > Hi, > > > > I''ve created a number of custom facts that i''ve added to manifests. If > > > i add the custom fact, have puppet push the custom fact file to the > > > host, then after it''s pushed it add it to the templates everything > > > works fine. However if i try and use the module on a fresh host > > > without the custom facter it fails. When it looks at the templates it > > > isn''t aware of the custom fact yet and errors out. > > > > How can i get it to pull down the facter plugin before it tries to > > > read the template file? > > > > I have tried: > > > > file { > > > "/etc/somefile": > > > owner => root, > > > group => root, > > > mode => 644, > > > require => File["/usr/lib/ruby/1.8/facter/custom_fact.rb"], > > > content => template("module/etc/somefile"); > > > } > > > > Any suggestions? I''d prefer not to have to add the custom facter to > > > the kickstart/jumpstart enviroment. > > > This is solved with pluginsync option. Puppet will download any custom > > facts/providers, so you should not distribute them to the agent as > > file resources. > > > Thanks, > > > Nan > > > -- > > 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.
Disconnect
2011-May-10 20:16 UTC
Re: [Puppet Users] Re: chicken and the egg.. pushing custom facter plugins for use within puppet..
Couple quick examples. In the dpkg/apt module: if ($lsbdistcodename == '''') { err("LsbDistCodename not set on $fqdn. Not configuring apt!") } else { Or use '''': in a case statement, eg: case $foo { ''1'': { foo } '''': { undefined } default: { other } } I''m having trouble finding specific examples in our current setup - I''ve been moving away from it in favor of running with pluginsync and --tags no_such_tag (so the problem doesn''t come up as often.) We used to have at least one template example but I can''t find it.. :/ On Thu, May 5, 2011 at 12:44 AM, Michael Dodwell <michael.dodwell@gmail.com>wrote:> > We work around it by checking the existence of the fact/value before > using it > > Is this done in the template file or somewhere else? Can you please > supply dummy code as an example? > > Thanks > > > > On May 5, 12:01 am, Disconnect <dc.disconn...@gmail.com> wrote: > > Although good advice (pluginsync is win) that still doesn''t solve the > > chicken/egg problem - puppet won''t evaluate the new facts on the first > run. > > > > We work around it by checking the existence of the fact/value before > using > > it. Not ideal but it works. (And on brand new hosts, we run puppetd -t > > --tags no_such_tag to get the sync done. We actually do it twice, so that > > the new values are pushed up to the puppetmaster before the ''real'' run, > but > > that probably isn''t strictly necessary.) > > > > > > > > > > > > > > > > On Tue, May 3, 2011 at 11:04 PM, Nan Liu <n...@puppetlabs.com> wrote: > > > On Tue, May 3, 2011 at 10:04 PM, Michael Dodwell > > > <michael.dodw...@gmail.com> wrote: > > > > Hi, > > > > > > I''ve created a number of custom facts that i''ve added to manifests. > If > > > > i add the custom fact, have puppet push the custom fact file to the > > > > host, then after it''s pushed it add it to the templates everything > > > > works fine. However if i try and use the module on a fresh host > > > > without the custom facter it fails. When it looks at the templates it > > > > isn''t aware of the custom fact yet and errors out. > > > > > > How can i get it to pull down the facter plugin before it tries to > > > > read the template file? > > > > > > I have tried: > > > > > > file { > > > > "/etc/somefile": > > > > owner => root, > > > > group => root, > > > > mode => 644, > > > > require => File["/usr/lib/ruby/1.8/facter/custom_fact.rb"], > > > > content => template("module/etc/somefile"); > > > > } > > > > > > Any suggestions? I''d prefer not to have to add the custom facter to > > > > the kickstart/jumpstart enviroment. > > > > > This is solved with pluginsync option. Puppet will download any custom > > > facts/providers, so you should not distribute them to the agent as > > > file resources. > > > > > Thanks, > > > > > Nan > > > > > -- > > > 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. > >-- 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.
Nan Liu
2011-May-10 22:19 UTC
Re: [Puppet Users] Re: chicken and the egg.. pushing custom facter plugins for use within puppet..
On Tue, May 10, 2011 at 3:16 PM, Disconnect <dc.disconnect@gmail.com> wrote:> Couple quick examples. In the dpkg/apt module: > if ($lsbdistcodename == '''') { > err("LsbDistCodename not set on $fqdn. Not configuring apt!") > } else { > > Or use '''': in a case statement, eg: > case $foo { > ''1'': { foo } > '''': { undefined } > default: { other } > }Ah, in this case lsbdistcodename is dependent on lsb packages. Yeah, unfortunately this can''t be solved with pluginsync, since pluginsync doesn''t install packages. This is one package I would suggest including in the base image. Pluginsync takes care of facts written purely in Ruby, so I did not consider these other cases and I don''t have a good solution for facts with external dependency. Maybe tag resources required for facts and run puppet agent -t --tags plugins. Definitely open for other better solutions. Thanks, Nan -- 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.