summaryrefslogtreecommitdiff
path: root/manifests/centos.pp
blob: 0c3ee45d4b2fb58150a9af6f3879505f85f9c62a (plain)
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
69
70
71
72
73
74
### centos
class apache::centos inherits apache::package {
    $config_dir = '/etc/httpd'

    Package[apache]{
        name => 'httpd',
    }
    Service[apache]{
        name => 'httpd',
        restart => '/etc/init.d/httpd graceful',
    }
    File[vhosts_dir]{
        path => "$config_dir/vhosts.d",
    }
    File[config_dir]{
        path => "$config_dir/conf.d",
    }
    File[include_dir]{
        path => "$config_dir/include.d",
    }
    File[modules_dir]{
        path => "$config_dir/modules.d",
    }
    File[web_dir]{
        path => "/var/www/vhosts",
    }
    File[default_apache_index]{
        path => '/var/www/html/index.html',
    }

    if $::selinux != 'false' {
      selinux::fcontext{
        ['/var/www/vhosts/.+/www(/.*)?',
         '/var/www/vhosts/.+/non_public(/.*)?',
         '/var/www/vhosts/.+/g2data(/.*)?',
         '/var/www/vhosts/.+/upload(/.*)?' ]:
          setype => 'httpd_sys_rw_content_t',
          before => File[web_dir];
      }
    }
    file{'apache_service_config':
        path => '/etc/sysconfig/httpd',
        source => [ "puppet:///modules/site-apache/service/CentOS/${fqdn}/httpd",
                    "puppet:///modules/site-apache/service/CentOS/httpd",
                    "puppet:///modules/apache/service/CentOS/httpd" ],
        require => Package['apache'],
        notify => Service['apache'],
        owner => root, group => 0, mode => 0644;
    }

    # this is for later fixes
    exec{
      'adjust_pidfile':
        command => 'sed -i  "s/^#PidFile \(.*\)/PidFile \1/g" /etc/httpd/conf/httpd.conf',
        unless => "grep -qE '^PidFile ' /etc/httpd/conf/httpd.conf",
        require => Package['apache'],
        notify => Service['apache'];
      'adjust_listen':
        command => 'sed -i  "s/^#Listen 80/Listen 80/g" /etc/httpd/conf/httpd.conf',
        unless => "grep -qE '^Listen 80' /etc/httpd/conf/httpd.conf",
        require => Package['apache'],
        notify => Service['apache'];
    }

    apache::config::global{'00-listen.conf':
      ensure => absent,
    }

    include apache::logrotate::centos

    apache::config::global{ 'welcome.conf': }
    apache::config::global{ 'vhosts.conf': }
}