M C
2011-May-26 12:50 UTC
[Puppet Users] Facts are propatating but dont work from within templates and classes
Hi, I have a big problem with custom facts. I created a stub module with a "lib/facter" directory as stated in the official Puppet documentation. This is the output i get: # puppetd -t --pluginsync info: Retrieving plugin notice: /File[/var/lib/puppet/lib]/mode: mode changed ''755'' to ''775'' notice: /File[/var/lib/puppet/lib/facter]/ensure: created notice: /File[/var/lib/puppet/lib/facter/certname.rb]/ensure: defined content as ''{md5}dd2f6e661ef1d2d29fa068e8a7d4aa19'' notice: /File[/var/lib/puppet/lib/facter/rootdevice.rb]/ensure: defined content as ''{md5}a19202a1c8e9f3da0f983403e463fd01'' info: Loading downloaded plugin /var/lib/puppet/lib/facter/rootdevice.rb info: Loading downloaded plugin /var/lib/puppet/lib/facter/certname.rb info: Loading facts in certname info: Loading facts in rootdevice info: Loading facts in certname info: Loading facts in rootdevice info: Caching catalog for puppet-1306413279 info: Applying configuration version ''1306413876'' notice: /Stage[main]/Test/File[/tmp/puppet.test]/ensure: created notice: Finished catalog run in 16.23 seconds root@puppet-1306413279:~# cat /tmp/puppet.test Certname: (empty string) -- As you can see, I get no output. This is the code of my "certname" fact: require ''facter'' Facter.add("certname") do setcode do %x{/usr/bin/puppet --configprint certname}.chomp end end -- Could you please tell me where is the problem? Thank you verymuch, Matteo -- 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.
Martin Alfke
2011-May-26 14:56 UTC
Re: [Puppet Users] Facts are propatating but dont work from within templates and classes
On May 26, 2011, at 2:50 PM, M C wrote:> Hi, I have a big problem with custom facts. I created a stub module with a "lib/facter" directory as stated in the official Puppet documentation. > This is the output i get: > > # puppetd -t --pluginsync > info: Retrieving plugin > notice: /File[/var/lib/puppet/lib]/mode: mode changed ''755'' to ''775'' > notice: /File[/var/lib/puppet/lib/facter]/ensure: created > notice: /File[/var/lib/puppet/lib/facter/certname.rb]/ensure: defined content as ''{md5}dd2f6e661ef1d2d29fa068e8a7d4aa19'' > notice: /File[/var/lib/puppet/lib/facter/rootdevice.rb]/ensure: defined content as ''{md5}a19202a1c8e9f3da0f983403e463fd01'' > info: Loading downloaded plugin /var/lib/puppet/lib/facter/rootdevice.rb > info: Loading downloaded plugin /var/lib/puppet/lib/facter/certname.rb > info: Loading facts in certname > info: Loading facts in rootdevice > info: Loading facts in certname > info: Loading facts in rootdevice > info: Caching catalog for puppet-1306413279 > info: Applying configuration version ''1306413876'' > notice: /Stage[main]/Test/File[/tmp/puppet.test]/ensure: created > notice: Finished catalog run in 16.23 seconds > root@puppet-1306413279:~# cat /tmp/puppet.testwhat does your file resource and template definition for /tmp/puppet.test look like. the following module snippets are working: class mytest { file "/tmp/puppet.test": content => template("mytest/puppet.test.erb") } } cat template/puppet.test.erb Certname: <%= certname %> cat /tmp/puppet.test Certname: localhost.localdomain> > Certname: > (empty string) > > -- > > As you can see, I get no output. This is the code of my "certname" fact: > > require ''facter'' > > Facter.add("certname") do > setcode do > %x{/usr/bin/puppet --configprint certname}.chomp > end > end > > -- > > Could you please tell me where is the problem? > > Thank you verymuch, > Matteo > > -- > 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.
M C
2011-May-27 08:36 UTC
Re: [Puppet Users] Facts are propatating but dont work from within templates and classes
Hi, could you please tell me your client and master .conf configuration? THanks , Matteo 2011/5/26 Martin Alfke <tuxmea@gmail.com>> > On May 26, 2011, at 2:50 PM, M C wrote: > > > Hi, I have a big problem with custom facts. I created a stub module with > a "lib/facter" directory as stated in the official Puppet documentation. > > This is the output i get: > > > > # puppetd -t --pluginsync > > info: Retrieving plugin > > notice: /File[/var/lib/puppet/lib]/mode: mode changed ''755'' to ''775'' > > notice: /File[/var/lib/puppet/lib/facter]/ensure: created > > notice: /File[/var/lib/puppet/lib/facter/certname.rb]/ensure: defined > content as ''{md5}dd2f6e661ef1d2d29fa068e8a7d4aa19'' > > notice: /File[/var/lib/puppet/lib/facter/rootdevice.rb]/ensure: defined > content as ''{md5}a19202a1c8e9f3da0f983403e463fd01'' > > info: Loading downloaded plugin /var/lib/puppet/lib/facter/rootdevice.rb > > info: Loading downloaded plugin /var/lib/puppet/lib/facter/certname.rb > > info: Loading facts in certname > > info: Loading facts in rootdevice > > info: Loading facts in certname > > info: Loading facts in rootdevice > > info: Caching catalog for puppet-1306413279 > > info: Applying configuration version ''1306413876'' > > notice: /Stage[main]/Test/File[/tmp/puppet.test]/ensure: created > > notice: Finished catalog run in 16.23 seconds > > root@puppet-1306413279:~# cat /tmp/puppet.test > > what does your file resource and template definition for /tmp/puppet.test > look like. > > the following module snippets are working: > > class mytest { > file "/tmp/puppet.test": > content => template("mytest/puppet.test.erb") > } > } > > cat template/puppet.test.erb > Certname: <%= certname %> > > cat /tmp/puppet.test > Certname: localhost.localdomain > > > > > Certname: > > (empty string) > > > > -- > > > > As you can see, I get no output. This is the code of my "certname" fact: > > > > require ''facter'' > > > > Facter.add("certname") do > > setcode do > > %x{/usr/bin/puppet --configprint certname}.chomp > > end > > end > > > > -- > > > > Could you please tell me where is the problem? > > > > Thank you verymuch, > > Matteo > > > > -- > > 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.
Martin Alfke
2011-May-27 14:49 UTC
Re: [Puppet Users] Facts are propatating but dont work from within templates and classes
On May 27, 2011, at 10:36 AM, M C wrote:> Hi, > > could you please tell me your client and master .conf configuration?My test was made on a single node using puppet agent. Here is my puppet.conf: $ cat /etc/puppetlabs/puppet/puppet.conf [main] vardir = /var/opt/lib/pe-puppet logdir = /var/log/pe-puppet rundir = /var/run/pe-puppet modulepath = /etc/puppetlabs/puppet/modules manifest = /etc/puppetlabs/puppet/manifests/site.pp user = pe-puppet group = pe-puppet [master] certname = puppetmaster.localdomain certdnsnames = puppet:puppet.localdomain:puppetmaster:puppetmaster.localdomain reports = http, store reportsurl = http://localhost:3000/reports/ ssl_client_header = SSL_CLIENT_S_DN ssl_client_verify_header = SSL_CLIENT_VERIFY [agent] certname = puppetagent.localdomain server = puppetmaster.localdomain report = true classfile = $vardir/classes.txt localconfig = $vardir/localconfig graph = true pluginsync = true [development] modulepath = /etc/puppetlabs/puppet/environments/development/modules manifest = /etc/puppetlabs/puppet/environments/development/manifests/site.pp [testing] modulepath = /etc/puppetlabs/puppet/environments/testing/modules manifest = /etc/puppetlabs/puppet/environments/testing/manifests/site.pp> > THanks , > Matteo > > 2011/5/26 Martin Alfke <tuxmea@gmail.com> > > On May 26, 2011, at 2:50 PM, M C wrote: > > > Hi, I have a big problem with custom facts. I created a stub module with a "lib/facter" directory as stated in the official Puppet documentation. > > This is the output i get: > > > > # puppetd -t --pluginsync > > info: Retrieving plugin > > notice: /File[/var/lib/puppet/lib]/mode: mode changed ''755'' to ''775'' > > notice: /File[/var/lib/puppet/lib/facter]/ensure: created > > notice: /File[/var/lib/puppet/lib/facter/certname.rb]/ensure: defined content as ''{md5}dd2f6e661ef1d2d29fa068e8a7d4aa19'' > > notice: /File[/var/lib/puppet/lib/facter/rootdevice.rb]/ensure: defined content as ''{md5}a19202a1c8e9f3da0f983403e463fd01'' > > info: Loading downloaded plugin /var/lib/puppet/lib/facter/rootdevice.rb > > info: Loading downloaded plugin /var/lib/puppet/lib/facter/certname.rb > > info: Loading facts in certname > > info: Loading facts in rootdevice > > info: Loading facts in certname > > info: Loading facts in rootdevice > > info: Caching catalog for puppet-1306413279 > > info: Applying configuration version ''1306413876'' > > notice: /Stage[main]/Test/File[/tmp/puppet.test]/ensure: created > > notice: Finished catalog run in 16.23 seconds > > root@puppet-1306413279:~# cat /tmp/puppet.test > > what does your file resource and template definition for /tmp/puppet.test look like. > > the following module snippets are working: > > class mytest { > file "/tmp/puppet.test": > content => template("mytest/puppet.test.erb") > } > } > > cat template/puppet.test.erb > Certname: <%= certname %> > > cat /tmp/puppet.test > Certname: localhost.localdomain > > > > > Certname: > > (empty string) > > > > -- > > > > As you can see, I get no output. This is the code of my "certname" fact: > > > > require ''facter'' > > > > Facter.add("certname") do > > setcode do > > %x{/usr/bin/puppet --configprint certname}.chomp > > end > > end > > > > -- > > > > Could you please tell me where is the problem? > > > > Thank you verymuch, > > Matteo > > > > -- > > 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.-- 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.
M C
2011-May-27 15:04 UTC
Re: [Puppet Users] Facts are propatating but dont work from within templates and classes
Thank you verymuch, Goodbye, Matteo 2011/5/27 Martin Alfke <tuxmea@gmail.com>> > On May 27, 2011, at 10:36 AM, M C wrote: > > > Hi, > > > > could you please tell me your client and master .conf configuration? > > My test was made on a single node using puppet agent. > Here is my puppet.conf: > > $ cat /etc/puppetlabs/puppet/puppet.conf > [main] > vardir = /var/opt/lib/pe-puppet > logdir = /var/log/pe-puppet > rundir = /var/run/pe-puppet > modulepath = /etc/puppetlabs/puppet/modules > manifest = /etc/puppetlabs/puppet/manifests/site.pp > user = pe-puppet > group = pe-puppet > > [master] > certname = puppetmaster.localdomain > certdnsnames > puppet:puppet.localdomain:puppetmaster:puppetmaster.localdomain > reports = http, store > reportsurl = http://localhost:3000/reports/ > ssl_client_header = SSL_CLIENT_S_DN > ssl_client_verify_header = SSL_CLIENT_VERIFY > > [agent] > certname = puppetagent.localdomain > server = puppetmaster.localdomain > report = true > classfile = $vardir/classes.txt > localconfig = $vardir/localconfig > graph = true > pluginsync = true > > [development] > modulepath = /etc/puppetlabs/puppet/environments/development/modules > manifest > /etc/puppetlabs/puppet/environments/development/manifests/site.pp > > [testing] > modulepath = /etc/puppetlabs/puppet/environments/testing/modules > manifest = /etc/puppetlabs/puppet/environments/testing/manifests/site.pp > > > > > > > THanks , > > Matteo > > > > 2011/5/26 Martin Alfke <tuxmea@gmail.com> > > > > On May 26, 2011, at 2:50 PM, M C wrote: > > > > > Hi, I have a big problem with custom facts. I created a stub module > with a "lib/facter" directory as stated in the official Puppet > documentation. > > > This is the output i get: > > > > > > # puppetd -t --pluginsync > > > info: Retrieving plugin > > > notice: /File[/var/lib/puppet/lib]/mode: mode changed ''755'' to ''775'' > > > notice: /File[/var/lib/puppet/lib/facter]/ensure: created > > > notice: /File[/var/lib/puppet/lib/facter/certname.rb]/ensure: defined > content as ''{md5}dd2f6e661ef1d2d29fa068e8a7d4aa19'' > > > notice: /File[/var/lib/puppet/lib/facter/rootdevice.rb]/ensure: defined > content as ''{md5}a19202a1c8e9f3da0f983403e463fd01'' > > > info: Loading downloaded plugin > /var/lib/puppet/lib/facter/rootdevice.rb > > > info: Loading downloaded plugin /var/lib/puppet/lib/facter/certname.rb > > > info: Loading facts in certname > > > info: Loading facts in rootdevice > > > info: Loading facts in certname > > > info: Loading facts in rootdevice > > > info: Caching catalog for puppet-1306413279 > > > info: Applying configuration version ''1306413876'' > > > notice: /Stage[main]/Test/File[/tmp/puppet.test]/ensure: created > > > notice: Finished catalog run in 16.23 seconds > > > root@puppet-1306413279:~# cat /tmp/puppet.test > > > > what does your file resource and template definition for /tmp/puppet.test > look like. > > > > the following module snippets are working: > > > > class mytest { > > file "/tmp/puppet.test": > > content => template("mytest/puppet.test.erb") > > } > > } > > > > cat template/puppet.test.erb > > Certname: <%= certname %> > > > > cat /tmp/puppet.test > > Certname: localhost.localdomain > > > > > > > > Certname: > > > (empty string) > > > > > > -- > > > > > > As you can see, I get no output. This is the code of my "certname" > fact: > > > > > > require ''facter'' > > > > > > Facter.add("certname") do > > > setcode do > > > %x{/usr/bin/puppet --configprint certname}.chomp > > > end > > > end > > > > > > -- > > > > > > Could you please tell me where is the problem? > > > > > > Thank you verymuch, > > > Matteo > > > > > > -- > > > 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. > > -- > 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.