Hello, I am running puppet server version 0.25.4-2, and since Debian squeeze is the new stable release I would like to adapt some of my modules. I have a syslog-ng module, I would like to specify another template for my squeeze server. I changed my init.pp as follow : if ($operatingsystemrelease <= 5.0.8) { $syslog_template = "syslog/syslog-ng.conf.erb" } else { $syslog_template = "syslog/syslog-ng.conf-squeeze.erb" } [...] file { "/etc/syslog-ng/syslog-ng.conf": ensure => present, mode => 644, owner => root, group => root, content => template($syslog_template), notify => service[syslog-ng], } I try this configuration thanks to the following post : http://groups.google.com/group/puppet-users/browse_thread/thread/33bafb3fff10171f But it doesn''t work. My old client are still using "syslog/syslog- ng.conf.erb" and I don''t get any error message. Maybe the puppet server is too old version for using facter operatingsystemrelease ? Thanks in advance. Regards -- 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 Feb 8, 2011, at 6:35 AM, Romgo wrote:> Hello, > > I am running puppet server version 0.25.4-2, and since Debian squeeze > is the new stable release I would like to adapt some of my modules. > > I have a syslog-ng module, I would like to specify another template > for my squeeze server. > > I changed my init.pp as follow : > > > if ($operatingsystemrelease <= 5.0.8) { > $syslog_template = "syslog/syslog-ng.conf.erb" > } > else { > $syslog_template = "syslog/syslog-ng.conf-squeeze.erb" > } > > [...] > > > file { "/etc/syslog-ng/syslog-ng.conf": > ensure => present, > mode => 644, > owner => root, > group => root, > content => template($syslog_template), > notify => service[syslog-ng], > } > > I try this configuration thanks to the following post : > http://groups.google.com/group/puppet-users/browse_thread/thread/33bafb3fff10171f > > But it doesn''t work. My old client are still using "syslog/syslog- > ng.conf.erb" and I don''t get any error message. > > Maybe the puppet server is too old version for using facter > operatingsystemrelease ?Run "factor | grep operatingsystemrelease" on your client and see what happens. If it doesn''t give output, try "factor" by itself and see if you have a typo in the name for the fact. I would guess that it''s not giving a version number, or giving one different from what you expect. -- 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.
> Run "factor | grep operatingsystemrelease" on your client and see what happens. If it doesn''t give output, try "factor" by itself and see if you have a typo in the name for the fact.Erm, that''s "facter operatingsystemrelease" or just "facter" :-) Factor is a helpful tool, but not here and now.> I would guess that it''s not giving a version number, or giving one different from what you expect.Quite possible. Note that facts can be different between different versions of facter (don''t get me started on the old lsbdistid etc.) However, I suspect your error is rooted elsewhere. Hint: http://docs.puppetlabs.com/references/stable/function.html#versioncmp HTH, Felix -- 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 Feb 8, 2011, at 11:47 PM, Felix Frank wrote:>> Run "factor | grep operatingsystemrelease" on your client and see what happens. If it doesn''t give output, try "factor" by itself and see if you have a typo in the name for the fact. > > Erm, that''s "facter operatingsystemrelease" or just "facter" :-) > Factor is a helpful tool, but not here and now.Ah thanks for the fix. -- 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.
Hello, thank you for the anwser. I try to run facter on both servers here it what I get : ~ # facter operatingsystemrelease 5.0.8 ~ $ facter operatingsystemrelease 6.0 So far no issues. Maybe in my if statement I should use " " ? Is there a way to print somewhere the value of the variables in order to be sure of what is return ? If not i''ll try to use versioncmp. Thanks On 9 February 2011 08:52, Patrick <kc7zzv@gmail.com> wrote:> > On Feb 8, 2011, at 11:47 PM, Felix Frank wrote: > > >> Run "factor | grep operatingsystemrelease" on your client and see what > happens. If it doesn''t give output, try "factor" by itself and see if you > have a typo in the name for the fact. > > > > Erm, that''s "facter operatingsystemrelease" or just "facter" :-) > > Factor is a helpful tool, but not here and now. > > Ah thanks for the fix. > > -- > 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.
> Is there a way to print somewhere the value of the variables in order > to be sure of what is return ?notify { "OS release detected as ''$operatingsystemrelease''": } -- 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.
Hello, I found the solution thanks to your help : if versioncmp($operatingsystemrelease, ''5.0.8'') > 0 { $syslog_template = "syslog/syslog-ng.conf-squeeze.erb" } else { $syslog_template = "syslog/syslog-ng.conf.erb" } and I add in my class : notify { "OS release detected as ''$operatingsystemrelease''": } notify { "template detected as ''$syslog_template''": } It works Thank you ! Hugo On 9 February 2011 10:48, Felix Frank <felix.frank@alumni.tu-berlin.de>wrote:> > Is there a way to print somewhere the value of the variables in order > > to be sure of what is return ? > > notify { "OS release detected as ''$operatingsystemrelease''": } > > -- > 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.