Hello all! I would like to install one package, but only with some condition was ok, like: package { "nagios-plugins-basic": ensure => "1.4.15-personal1", unless => "test `ls -ld /opt/nrpe* 2>/dev/null | wc -l` -ge 1", } but this not work =/ Could not retrieve catalog from remote server: Error 400 on SERVER: Invalid parameter unless at /etc/puppet/modules/nagios/manifests/ubuntu.pp:13 on node domu-12-31-39-0c-24-ce.compute-1.internal How can I do this? Thanks!! -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Hello, First, the manifest is compiled on the master, not the agent, so that test isn''t being run where I think you want it to be run. Second, you want the language guide: http://docs.puppetlabs.com/guides/language_guide.html#conditionals You should wrap the resource in your test. What you really want, by the sound of things, is a custom fact. Cheers, On Fri, 2013-03-01 at 12:00 -0800, Tiago Cruz wrote:> Hello all! > > > I would like to install one package, but only with some condition was > ok, like: > > > package { "nagios-plugins-basic": > ensure => "1.4.15-personal1", > unless => "test `ls -ld /opt/nrpe* 2>/dev/null | wc -l` -ge 1", > } > > > but this not work =/ > > > Could not retrieve catalog from remote server: Error 400 on SERVER: > Invalid parameter unless > at /etc/puppet/modules/nagios/manifests/ubuntu.pp:13 on node > domu-12-31-39-0c-24-ce.compute-1.internal > > > > How can I do this? > > > Thanks!! > > -- > You received this message because you are subscribed to the Google > Groups "Puppet Users" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to puppet-users+unsubscribe@googlegroups.com. > To post to this group, send email to puppet-users@googlegroups.com. > Visit this group at http://groups.google.com/group/puppet-users?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > >-- Stephen Gran Senior Systems Integrator - guardian.co.uk Please consider the environment before printing this email. ------------------------------------------------------------------ Visit guardian.co.uk - website of the year www.guardian.co.uk www.observer.co.uk www.guardiannews.com On your mobile, visit m.guardian.co.uk or download the Guardian iPhone app www.guardian.co.uk/iphone and iPad edition www.guardian.co.uk/iPad Save up to 32% by subscribing to the Guardian and Observer - choose the papers you want and get full digital access. Visit guardian.co.uk/subscribe --------------------------------------------------------------------- This e-mail and all attachments are confidential and may also be privileged. If you are not the named recipient, please notify the sender and delete the e-mail and all attachments immediately. Do not disclose the contents to another person. You may not use the information for any purpose, or store, or copy, it in any way. Guardian News & Media Limited is not liable for any computer viruses or other material transmitted with or as part of this e-mail. You should employ virus checking software. Guardian News & Media Limited A member of Guardian Media Group plc Registered Office PO Box 68164 Kings Place 90 York Way London N1P 2AP Registered in England Number 908396 -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
The unless parameter is only accepted by the exec resource. You''re trying to use it in a package resource, and thus the error you''re getting. You sort of need to make sure that the class that this resource is enclosed in is only include''d on those nodes that need it. On Friday, March 1, 2013 12:00:24 PM UTC-8, Tiago Cruz wrote:> > Hello all! > > I would like to install one package, but only with some condition was ok, > like: > > package { "nagios-plugins-basic": > ensure => "1.4.15-personal1", > unless => "test `ls -ld /opt/nrpe* 2>/dev/null | wc -l` -ge 1", > } > > but this not work =/ > > Could not retrieve catalog from remote server: Error 400 on SERVER: > Invalid parameter unless at > /etc/puppet/modules/nagios/manifests/ubuntu.pp:13 on node > domu-12-31-39-0c-24-ce.compute-1.internal > > How can I do this? > > Thanks!! >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
On Friday, March 1, 2013 2:00:24 PM UTC-6, Tiago Cruz wrote:> > Hello all! > > I would like to install one package, but only with some condition was ok, > like: > > package { "nagios-plugins-basic": > ensure => "1.4.15-personal1", > unless => "test `ls -ld /opt/nrpe* 2>/dev/null | wc -l` -ge 1", > } > > but this not work =/ > > Could not retrieve catalog from remote server: Error 400 on SERVER: > Invalid parameter unless at > /etc/puppet/modules/nagios/manifests/ubuntu.pp:13 on node > domu-12-31-39-0c-24-ce.compute-1.internal > > How can I do this? > >If you must do that, then you need to create a custom fact (it''s not difficult) to report on the condition you want to test (for example, the output of `ls -ld /opt/nrpe* 2>/dev/null | wc -l). Then put your Package declaration in an ''if'' or ''case'' block that selects the desired behavior based on the fact value. With that said, you are probably going about this the wrong way. It is usually better to centralize decisions about how nodes are supposed to be configured on the master. In this case, that would mean Puppet knows, based on essential characteristics of the node such as its name, network, etc., not only whether the nagios plugins should be present, but also whether nrpe should be present. It can then ensure *both* are installed if they are supposed to be there (or that they are absent otherwise). Also, you should consider whether you are making unnecessary work for yourself. It may be that you are duplicating work that your package management system would be happy to do for you. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Hello guys, Thanks for the tips you all sent me! I''ll write my own facter, sound the better way to solve this. About duplicating work, I agree with you. The big problem is: The company was compiled in all machines the nrpe and nagios-plugins to /opt, and now I''m suffering to try to control this. New machines will be raised with rpm/deb packages that I made, but I can''t break the production environment :) On Monday, March 4, 2013 11:41:24 AM UTC-3, jcbollinger wrote:> > Also, you should consider whether you are making unnecessary work for > yourself. It may be that you are duplicating work that your package > management system would be happy to do for you. > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.