Puppet Class: apache::config

Defined in:
manifests/config.pp

Overview



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'manifests/config.pp', line 1

class apache::config {

  group { $apache::params::group:
    ensure  => present,
    require => Class['apache::install']
  }
  user  { $apache::params::user:
    ensure     => present,
    home       => $apache::params::home,
    managehome => false,
    membership => 'minimum',
    groups     => [],
    shell      => '/sbin/nologin',
    require    => Group[$apache::params::group],
  }

  file { $apache::params::home:
    ensure => directory,
    owner  => $apache::params::user,
    group  => $apache::params::group
  }
  file { $apache::params::conffile:
    mode    => '0644',
    notify  => Exec['reload-apache'],
    require => Class['apache::install'],
  }
  file { $apache::params::configdir:
    ensure  => directory,
    mode    => '0644',
    notify  => Exec['reload-apache'],
    require => Class['apache::install'],
  }

  # Ensure the Version module is loaded as we need it in the Foreman vhosts
  # RedHat distros come with this enabled. Newer Debian and Ubuntu distros
  # comes also with this enabled. Only old Debian and Ubuntu distros (squeeze,
  # lucid, precise) needs hand-holding.
  case $::lsbdistcodename {
    'squeeze','lucid','precise': {
      exec { 'enable-version':
        command => '/usr/sbin/a2enmod version',
        creates => '/etc/apache2/mods-enabled/version.load',
        notify  => Service['httpd'],
        require => Class['apache::install'],
      }
    }
    default: {}
  }

  # For Apache2 Rails assets optimalization
  case $::osfamily {
    'Debian': {
      exec { 'enable-expires':
        command => '/usr/sbin/a2enmod expires',
        creates => '/etc/apache2/mods-enabled/expires.load',
        notify  => Service['httpd'],
        require => Class['apache::install'],
      }
      exec { 'enable-rewrite':
        command => '/usr/sbin/a2enmod rewrite',
        creates => '/etc/apache2/mods-enabled/rewrite.load',
        notify  => Service['httpd'],
        require => Class['apache::install'],
      }
    }
    default: {}
  }
}