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,
content => template($sudo_template),
backup => ".bak"
}
Seems legit at least ;)
On Dec 17, 2010, at 3:51 PM, CraftyTech 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 [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.
--
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.