dev/provisioning/modules/apache/manifests/mod/status.pp
changeset 28 b0b56e0f8c7f
equal deleted inserted replaced
27:a2342f26c9de 28:b0b56e0f8c7f
       
     1 # Class: apache::mod::status
       
     2 #
       
     3 # This class enables and configures Apache mod_status
       
     4 # See: http://httpd.apache.org/docs/current/mod/mod_status.html
       
     5 #
       
     6 # Parameters:
       
     7 # - $allow_from is an array of hosts, ip addresses, partial network numbers
       
     8 #   or networks in CIDR notation specifying what hosts can view the special
       
     9 #   /server-status URL.  Defaults to ['127.0.0.1', '::1'].
       
    10 # - $extended_status track and display extended status information. Valid
       
    11 #   values are 'On' or 'Off'.  Defaults to 'On'.
       
    12 # - $status_path is the path assigned to the Location directive which
       
    13 #   defines the URL to access the server status. Defaults to '/server-status'.
       
    14 # 
       
    15 # Actions:
       
    16 # - Enable and configure Apache mod_status
       
    17 #
       
    18 # Requires:
       
    19 # - The apache class
       
    20 #
       
    21 # Sample Usage:
       
    22 #
       
    23 #  # Simple usage allowing access from localhost and a private subnet
       
    24 #  class { 'apache::mod::status':
       
    25 #    $allow_from => ['127.0.0.1', '10.10.10.10/24'],
       
    26 #  }
       
    27 #
       
    28 class apache::mod::status (
       
    29   $allow_from      = ['127.0.0.1','::1'],
       
    30   $extended_status = 'On',
       
    31   $apache_version = $::apache::apache_version,
       
    32   $status_path     = '/server-status',
       
    33 ){
       
    34   validate_array($allow_from)
       
    35   validate_re(downcase($extended_status), '^(on|off)$', "${extended_status} is not supported for extended_status.  Allowed values are 'On' and 'Off'.")
       
    36   ::apache::mod { 'status': }
       
    37   # Template uses $allow_from, $extended_status, $apache_version, $status_path
       
    38   file { 'status.conf':
       
    39     ensure  => file,
       
    40     path    => "${::apache::mod_dir}/status.conf",
       
    41     content => template('apache/mod/status.conf.erb'),
       
    42     require => Exec["mkdir ${::apache::mod_dir}"],
       
    43     before  => File[$::apache::mod_dir],
       
    44     notify  => Class['apache::service'],
       
    45   }
       
    46 }