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.erb", default => "${module_name}/sun.inittab.erb", } Then your file resource file { "/etc/inittab": owner => root, group => root, mode => 0644, content => template($template_name), backup => ".bak", } It's also best practice to use selectors outside resource block per http://puppet-lint.com/checks/selector_inside_resource/ I hope it helps. -frederiko On Thu, Sep 5, 2013 at 5:04 PM, <[email protected]> wrote: > 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 => template("${module_name}/sun.inittab.erb")}, > backup => ".bak" > > > On Friday, December 17, 2010 1:09:52 PM UTC-8, CraftyTech wrote: >> >> 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 unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/puppet-users. > For more options, visit https://groups.google.com/groups/opt_out. > -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
