Re: [Puppet Users] if then statement within file resource

2013-09-05 Thread Frederiko Costa
Hi, I believe in that case you should use selectors to make it work. http://docs.puppetlabs.com/puppet/2.7/reference/lang_conditional.html#selectors Or you can use the 'if' outside the file resource. Something like this: $template_name = $manufacter ? { 'ibm' => "${module_name}/ibm.inittab.e

Re: [Puppet Users] if then statement within file resource

2013-09-05 Thread svrsvr91
Hi i am trying the same it is not working can u explain me how it worked file { "/etc/inittab": owner => root, group => root, mode => 0644, if $manufacturer=IBM { content => template("${module_name}/ibm.inittab.erb")}, else { content => te

Re: [Puppet Users] if then statement within file resource

2010-12-17 Thread CraftyTech
That worked out Wondering why it didn't inside the file resource... but it the workaround is certainly is "legit" enough 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...@google

Re: [Puppet Users] if then statement within file resource

2010-12-17 Thread Eric Sorenson
On Dec 17, 2010, at 12:51 PM, CraftyTech wrote: > 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: Yes the language tutorial on condit

Re: [Puppet Users] if then statement within file resource

2010-12-17 Thread Mark Stanislav
What about just doing: if ($operatingsystemrelease <= 5.4) { $sudo_template = "system/sudoers_V54.erb" } else { $sudo_template = "system/sudoers.erb" } class basic_dev::files { file { "/etc/sudoers": owner => root, group => root, mode => 0440,

Re: [Puppet Users] if then statement within file resource

2010-12-17 Thread Disconnect
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 d