You can do it magically with source, not sure about template though. source => ["puppet:///system/sudoers_$operatingsysstemrelease","puppet:///system/sudoers"] (it will look for them in order. We have several that go hostname, $lsbdistcodename, generic.)
If it doesn't work for template, you can do it the hard way: if $operatingsystemrelease <= 5.4 { file { "/etc/sudoers":....etc } else { file { "/etc/sudoers":..... } On Fri, Dec 17, 2010 at 3:51 PM, CraftyTech <hmmed...@gmail.com> wrote: > Hello All, > > I'm not able to do an if/then statement within a file resource > declaration. I'm basically trying to distinguish between OS release, so > that I can assign an appropriate template. This is what I have: > > class basic_dev::files { > file { "/etc/sudoers": > owner => root, > group => root, > mode => 0440, > if $operatingsystemrelease <= 5.4 then { > content => template("system/sudoers_V54.erb")}, > else { > content => template("system/sudoers.erb")}, > backup => ".bak" > } > For some reason is not working. I keep on getting error: "Could not > retrieve catalog from remote server: Error 400 on SERVER: Syntax error at > 'if'; expected '}' " > > Any ideas? > > Thanks, > > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to puppet-us...@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscr...@googlegroups.com<puppet-users%2bunsubscr...@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-us...@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.