dev/provisioning/modules/apache/manifests/version.pp
changeset 28 b0b56e0f8c7f
equal deleted inserted replaced
27:a2342f26c9de 28:b0b56e0f8c7f
       
     1 # Class: apache::version
       
     2 #
       
     3 # Try to automatically detect the version by OS
       
     4 #
       
     5 class apache::version {
       
     6   # This will be 5 or 6 on RedHat, 6 or wheezy on Debian, 12 or quantal on Ubuntu, etc.
       
     7   $osr_array = split($::operatingsystemrelease,'[\/\.]')
       
     8   $distrelease = $osr_array[0]
       
     9   if ! $distrelease {
       
    10     fail("Class['apache::version']: Unparsable \$::operatingsystemrelease: ${::operatingsystemrelease}")
       
    11   }
       
    12 
       
    13   case $::osfamily {
       
    14     'RedHat': {
       
    15       if ($::operatingsystem == 'Amazon') {
       
    16         $default = '2.2'
       
    17       } elsif ($::operatingsystem == 'Fedora' and versioncmp($distrelease, '18') >= 0) or ($::operatingsystem != 'Fedora' and versioncmp($distrelease, '7') >= 0) {
       
    18         $default = '2.4'
       
    19       } else {
       
    20         $default = '2.2'
       
    21       }
       
    22     }
       
    23     'Debian': {
       
    24       if $::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '13.10') >= 0 {
       
    25         $default = '2.4'
       
    26       } elsif $::operatingsystem == 'Debian' and versioncmp($distrelease, '8') >= 0 {
       
    27         $default = '2.4'
       
    28       } else {
       
    29         $default = '2.2'
       
    30       }
       
    31     }
       
    32     'FreeBSD': {
       
    33       $default = '2.4'
       
    34     }
       
    35     'Gentoo': {
       
    36       $default = '2.4'
       
    37     }
       
    38     'Suse': {
       
    39       $default = '2.2'
       
    40     }
       
    41     default: {
       
    42       fail("Class['apache::version']: Unsupported osfamily: ${::osfamily}")
       
    43     }
       
    44   }
       
    45 }