I'm new to puppet so any help would be appreciated. I'm trying to pass static data into variable apache_version inside Puppet class depending on OS release version. This variable will be later used in .erb template file to configure apache according to version. For now my class looks like this:
class some_class_name () {
case $::operatingsystem {
'RedHat' : {
case $::operatingsystemrelease {
/^7\..*/ : { }
/^6\..*/ : { }
}
}
}
}
How can I define inside {} brackets this variable? As for .erb file it should be used like this:
<%- if @apache_version >= '2.4' -%>
set something
<%- else -%>
set something else
<%- end -%>
I was aiming for something like this:
class some_class_name () {
case $::operatingsystem {
'RedHat' : {
case $::operatingsystemrelease {
/^7\..*/ : { $apache_version = '2.4' }
/^6\..*/ : { $apache_version = '2.2' }
}
}
}
}
but it doesn't work.
facter operatingsystemandfacter operatingsystemreleaseoutput exactly? Are you includingsome_class_name? How are you checking the value of$apache_version? Addnotify { "Version: ${apache_version}": }perhaps. - Dominic Clealfacter operatingsystemgivesRedHatfacter operatingsystemreleasegives7.2(at least on system I'm working right now)some_class_nameis included ininit.ppfile correctly. As for checking - I'm not checking it anywhere. Should I? Shouldn't it work like this, that once I assign version to variable it should be used in.rbfile? - NRGtemplate()call is in the same scope, but the manifest shown doesn't have a template() call so it's hard to say whether this is correct. - Dominic Cleal.*- Matt Schuchard