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 conditionals explains this. You can use a
selector inside the resource or the if/else syntax outside the resource to set
a variable. Selector is less nice because you can't do the numeric comparison,
you have to fake it with a regexp.
ie.
file {"/etc/sudoers":
content => $operatingsystemrelease ?
/^5.[01234]/ => template("system/sudoers_V54.erb"),
default => template("system/sudeors.erb")
}
or as other people described, move your if/else outside the resource to set a
local variable that you then expand.
- Eric Sorenson - N37 17.255 W121 55.738 - http://twitter.com/ahpook -
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.