summaryrefslogtreecommitdiff
path: root/manifests/init.pp
blob: 82baaef8ba690830ff829f83de42f5ed1b3df3bf (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
# modules/apache/manifests/init.pp
# 2008 - admin(at)immerda.ch
# License: GPLv3


class apache {
    package { 'apache':
        name => $operatingsystem ? {
            centos => 'httpd',
            default => 'apache'
        },
        category => $operatingsystem ? {
            gentoo => 'www-servers',
            default => '',
        },
            ensure => present,
        }

    case $operatingsystem {
        centos: {
            package { 'mod_ssl':
                name => 'mod_ssl',
                    ensure => present,
            }
        }
    }

    service { apache:
        name => $operatingsystem ? {
            centos => 'httpd',
            default => 'apache2'
        },
        enable => true,
        ensure => running,
        require => Package[apache],
    }

    file { 'default_index':
        path => $operatingsystem ? {
            centos => '/var/www/html/index.html',
            default => '/var/www/localhost/index.html'
        },
        ensure => file,
        owner => 'root',
        group => 0,
        mode => 644,
        require => Package[apache],
        content => template('apache/default/default_index.erb'),
    }

    case $operatingsystem {
        centos:  { include apache_centos }
    }
}



### distro specific stuff
class apache_centos {
        file {'/etc/httpd/vhosts.d':
                ensure => directory,
                owner => root,
                group => 0,
                mode => 700,
        }
}