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
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
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
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
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,
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