Mohamed Lrhazi
2011-Jan-07 03:07 UTC
[Puppet Users] Silence reports for one specific resource?
I have puppet configured on all hosts as described in the previous post of mine... basically two instances are running, one as daemon, which does not download the config and just waits for puppetrunner calls, and one that does, started from cron, but runs in noop mode. My problem is as follows: I added one resource to all the hosts, which dumps all environment variables to a file called: /etc/mcollective/facts.yaml This resource always reports that a change needs to be made, since that file content is always changing... How do I silence this resource, so it does not report that every time? I have a second issue with this new resource... I really would want it executed each time, and not only when there are other changes in the pipe and I issue a puppetrun.... Is there a way to run puppet in noop mode, excluding one resource from the noop? Thanks a lot. Mohamed. -- 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.
Alan Barrett
2011-Jan-07 06:55 UTC
Re: [Puppet Users] Silence reports for one specific resource?
On Thu, 06 Jan 2011, Mohamed Lrhazi wrote:> I added one resource to all the hosts, which dumps all environment > variables to a file called: /etc/mcollective/facts.yaml > This resource always reports that a change needs to be made, since > that file content is always changing... > > How do I silence this resource, so it does not report that every time?I probably wouldn''t do this, but: exec { "secret stuff": command => "/bin/false", unless => "do the real work here", }> I have a second issue with this new resource... I really would want it > executed each time, and not only when there are other changes in the > pipe and I issue a puppetrun.... Is there a way to run puppet in noop > mode, excluding one resource from the noop?exec { "run this even in noop mode": command => "whatever", noop => false, # overrides global noop mode } --apb (Alan Barrett) -- 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.
Patrick
2011-Jan-07 08:20 UTC
Re: [Puppet Users] Silence reports for one specific resource?
On Jan 6, 2011, at 10:55 PM, Alan Barrett wrote:> On Thu, 06 Jan 2011, Mohamed Lrhazi wrote: >> I added one resource to all the hosts, which dumps all environment >> variables to a file called: /etc/mcollective/facts.yaml >> This resource always reports that a change needs to be made, since >> that file content is always changing... >> >> How do I silence this resource, so it does not report that every time? > > I probably wouldn''t do this, but: > > exec { "secret stuff": > command => "/bin/false", > unless => "do the real work here", > }I don''t know if it''s a problem, but this will probably run in noop mode and noop mode won''t do anything except make run failures silent to you should probably change this by adding "noop => false" to be explicit. -- 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.
Alan Barrett
2011-Jan-07 10:26 UTC
Re: [Puppet Users] Silence reports for one specific resource?
On Fri, 07 Jan 2011, Patrick wrote:> On Jan 6, 2011, at 10:55 PM, Alan Barrett wrote: > > I probably wouldn''t do this, but: > > > > exec { "secret stuff": > > command => "/bin/false", > > unless => "do the real work here", > > } > > I don''t know if it''s a problem, but this will probably run in noop > mode and noop mode won''t do anything except make run failures silent > to you should probably change this by adding "noop => false" to be > explicit.Yes, as you imply and as I neglected to state earlier, the "unless" command always runs, even in noop mode. If it''s successful, then nothing more happens, and the report indicates that the resource was in sync. If the "unless" command fails in no-noop mode , then the "command" command runs, and because the command is /bin/false, thet fails too, and puppet reports the error. If the "unless" command fails in noop mode , then the "command" command does not run, but the failure is not completely silent; the report will show that the resource is out of sync, and in --test or --verbose mode there will be a log message like "Exec[secret stuff] is notrun should be 0 (noop)". --apb (Alan Barrett) -- 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.
Mohamed Lrhazi
2011-Jan-07 13:28 UTC
Re: [Puppet Users] Silence reports for one specific resource?
Thanks a lot guys... but how do I do this, both silencing reporting and overriding noop mode, for a resource other than "exec"... mine is: file { "/etc/puppet/facts.yaml": ensure => file, content => inline_template("<%= scope.to_hash.reject { |k,v| !( k.is_a?(String) && v.is_a?(String) ) }.to_yaml %>"), } -- 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.
Thomas Bellman
2011-Jan-12 19:16 UTC
Re: [Puppet Users] Silence reports for one specific resource?
Mohamed Lrhazi wrote:> Thanks a lot guys... but how do I do this, both silencing reporting > and overriding noop mode, for a resource other than "exec"... mine is: > > file { > "/etc/puppet/facts.yaml": > ensure => file, > content => inline_template("<%= scope.to_hash.reject { |k,v| !( > k.is_a?(String) && v.is_a?(String) ) }.to_yaml %>"), > }There is a metaparameter called ''loglevel''. If you set that to something lower than "notice" (i.e. either "info" or "debug"), then Puppet won''t report that it applied the resource: file { "/etc/puppet/facts.yaml": ..., loglevel => debug, noop => false; } Myself, I do somewhat the opposite: I also run Puppet from cron, but not in noop mode. Since I''m not interrested in getting dozens or hundreds of mails every time I make a configuration change, I filter away all the notice messages, with a simple grep: puppetd ... | egrep -v ''^notice:'' However, on one resources I set ''loglevel => warning'', so I get a warning message whenever Puppet fixes that particular resource, because when that situation happens I want to check manually that it was the correct action to take. (Specifically, in grub.conf I set the parameter ''default'' to 0 so it will always default to boot the first kernel. I do this since I have sometimes found that after installing a new kernel, grub.conf still defaulted to boot the old kernel. But I don''t yet quite trust that setting default=0 will always be the right thing.) /Bellman -- 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.
Mohamed Lrhazi
2011-Jan-12 20:31 UTC
Re: [Puppet Users] Silence reports for one specific resource?
Thanks you so much Bellman, the loglevel seems to be missing corner stone :) Mohamed. On Wed, Jan 12, 2011 at 2:16 PM, Thomas Bellman <bellman@nsc.liu.se> wrote:> Mohamed Lrhazi wrote: > >> Thanks a lot guys... but how do I do this, both silencing reporting >> and overriding noop mode, for a resource other than "exec"... mine is: >> >> file { >> "/etc/puppet/facts.yaml": >> ensure => file, >> content => inline_template("<%= scope.to_hash.reject { |k,v| !( >> k.is_a?(String) && v.is_a?(String) ) }.to_yaml %>"), >> } > > There is a metaparameter called ''loglevel''. If you set that > to something lower than "notice" (i.e. either "info" or "debug"), > then Puppet won''t report that it applied the resource: > > file { > "/etc/puppet/facts.yaml": > ..., > loglevel => debug, noop => false; > } > > > Myself, I do somewhat the opposite: I also run Puppet from cron, > but not in noop mode. Since I''m not interrested in getting dozens > or hundreds of mails every time I make a configuration change, I > filter away all the notice messages, with a simple grep: > > puppetd ... | egrep -v ''^notice:'' > > However, on one resources I set ''loglevel => warning'', so I get > a warning message whenever Puppet fixes that particular resource, > because when that situation happens I want to check manually that > it was the correct action to take. (Specifically, in grub.conf > I set the parameter ''default'' to 0 so it will always default to > boot the first kernel. I do this since I have sometimes found > that after installing a new kernel, grub.conf still defaulted to > boot the old kernel. But I don''t yet quite trust that setting > default=0 will always be the right thing.) > > > /Bellman > > -- > 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.
R.I.Pienaar
2011-Jan-12 20:41 UTC
Re: [Puppet Users] Silence reports for one specific resource?
hey, ----- Original Message -----> Thanks you so much Bellman, the loglevel seems to be missing corner > stone :)This is great, I never know the loglevel meta param did this. Updated the mcollective wiki to reflect this :)> > Mohamed. > > On Wed, Jan 12, 2011 at 2:16 PM, Thomas Bellman <bellman@nsc.liu.se> > wrote: > > Mohamed Lrhazi wrote: > > > >> Thanks a lot guys... but how do I do this, both silencing reporting > >> and overriding noop mode, for a resource other than "exec"... mine > >> is: > >> > >> file { > >> "/etc/puppet/facts.yaml": > >> ensure => file, > >> content => inline_template("<%= scope.to_hash.reject { |k,v| > >> !( > >> k.is_a?(String) && v.is_a?(String) ) }.to_yaml %>"), > >> } > > > > There is a metaparameter called ''loglevel''. If you set that > > to something lower than "notice" (i.e. either "info" or "debug"), > > then Puppet won''t report that it applied the resource: > > > > file { > > "/etc/puppet/facts.yaml": > > ..., > > loglevel => debug, noop => false; > > } > > > > > > Myself, I do somewhat the opposite: I also run Puppet from cron, > > but not in noop mode. Since I''m not interrested in getting dozens > > or hundreds of mails every time I make a configuration change, I > > filter away all the notice messages, with a simple grep: > > > > puppetd ... | egrep -v ''^notice:'' > > > > However, on one resources I set ''loglevel => warning'', so I get > > a warning message whenever Puppet fixes that particular resource, > > because when that situation happens I want to check manually that > > it was the correct action to take. (Specifically, in grub.conf > > I set the parameter ''default'' to 0 so it will always default to > > boot the first kernel. I do this since I have sometimes found > > that after installing a new kernel, grub.conf still defaulted to > > boot the old kernel. But I don''t yet quite trust that setting > > default=0 will always be the right thing.) > > > > > > /Bellman > > > > -- > > 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.-- R.I.Pienaar -- 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.