summaryrefslogtreecommitdiff
path: root/manifests/init.pp
blob: efa263aef9058a2dac890e7861e0c25c417456ef (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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#
# puppet module
# modules/puppet/manifests/init.pp - manage puppet stuff
# original by luke kanies
# http://github.com/lak
# adapted by puzzel itc
# merged with immerda project group's
# solution
#
# Copyright 2008, admin(at)immerda.ch
# Copyright 2008, Puzzle ITC GmbH
# Marcel Härry haerry+puppet(at)puzzle.ch
# Simon Josi josi+puppet(at)puzzle.ch
#
# This program is free software; you can redistribute 
# it and/or modify it under the terms of the GNU 
# General Public License version 3 as published by 
# the Free Software Foundation.
#

# modules_dir { "puppet": }

class puppet {
    case $kernel {
        linux: { case $operatingsystem {
                    gentoo:  { include puppet::gentoo }
                    centos:  { include puppet::centos }
                    debian:  { include puppet::debian }
                    default: { include puppet::linux}
                 }
        }
        openbsd: { include puppet::openbsd}
    }

    $real_puppet_config = $puppet_config ? {
        '' => "/etc/puppet/puppet.conf",
        default => $puppet_config,
    }

    file { 'puppet_config':
        path => "$real_puppet_config",
        source => [ "puppet://$server/files/puppet/client/${fqdn}/puppet.conf",
                "puppet://$server/files/puppet/client/puppet.conf.$operatingsystem",
                "puppet://$server/files/puppet/client/puppet.conf",
                "puppet://$server/puppet/client/puppet.conf.$operatingsystem",
                "puppet://$server/puppet/client/puppet.conf" ],
        notify => Service[puppet],
        owner => root, group => 0, mode => 600;
    }
}

class puppet::linux {
    # package bc needed for cron
    package{ [ 'puppet', 'facter', 'bc' ]:
        ensure => present,
    }

    service{'puppet':
        ensure => running,
        enable => true,
        hasstatus => true,
        hasrestart => true,
        pattern => puppetd,
        require => Package[puppet],
    }

    file{'/etc/cron.d/puppetd.cron':
        source => [ "puppet://$server/puppet/cron.d/puppetd.${operatingsystem}",
                    "puppet://$server/puppet/cron.d/puppetd" ],
        owner => root, group => 0, mode => 0644;
    }
}
class puppet::gentoo inherits puppet::linux {
    Package[puppet]{
        category => 'app-admin',
    }
    Package[facter]{
        category => 'dev-ruby',
    }
    # as we use sometimes the init script to test
    Service[puppet]{
        hasstatus => false,
    }
}
class puppet::debian inherits puppet::linux {
    # there is really no status cmd for it
    Service[puppet]{
        hasstatus => false,
    }
}

class puppet::centos inherits puppet::linux {
    file{'/etc/sysconfig/puppet':
        source => [ "puppet://$server/files/puppet/sysconfig/${fqdn}/puppet",
                    "puppet://$server/files/puppet/sysconfig/${domain}/puppet",
                    "puppet://$server/files/puppet/sysconfig/puppet",
                    "puppet://$server/puppet/sysconfig/puppet" ],
        notify => Service[puppet],
        owner => root, group => 0, mode => 0644;
    }
}
class puppet::openbsd {
    service{'puppet':
        provider => base,
        pattern => puppetd,
        ensure => running,
    }
}