aboutsummaryrefslogtreecommitdiffstats
path: root/modules/bind/manifests/init.pp
blob: 585c04fb7d48e3863a6d1a26c56f7c15a9cdd1c0 (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
class bind {
    class bind_base {
        package { bind:
            ensure => installed
        }

        service { named:
            ensure => running,
            path => "/etc/init.d/named",
            subscribe => [ Package["bind"]]
        }

        file { '/etc/named.conf':
            ensure => "/var/lib/named/etc/named.conf",
            owner => root,
            group => root,
            mode => 644,
            require => Package[bind]
        } 
    }


    file { '/var/lib/named/etc/named.conf':
        ensure => present,
        owner => root,
        group => root,
        mode => 644,
        require => Package["bind"],
        content => "",
        notify => [Service['named']]
    }

    define zone_base($content = false) {
        if ! $content {
            $zone_content = template("bind/zones/$name.zone")
        } else {
            $zone_content = $content
        }
        file { "/var/lib/named/var/named/$zone_subdir/$name.zone":
            ensure => present,
            owner => root,
            group => root,
            mode => 644,
            content => $zone_content,
            require => Package[bind],
            notify => Service[named]
        }
    }

    define zone_master($content = false) {
        $zone_subdir = "master"
        zone_base { $name : 
            content => $content 
        }
    }

    define zone_reverse($content = false) {
        $zone_subdir = "reverse"
        zone_base { $name : 
            content => $content 
        } 
    }


    class bind_master inherits bind_base {
        file { '/var/lib/named/etc/named.conf':
            content => template("bind/named_base.conf", "bind/named_master.conf"),
        }
    }

    class bind_slave inherits bind_base {
        file { '/var/lib/named/etc/named.conf':
            content => template("bind/named_base.conf", "bind/named_slave.conf"),
        }
    }

}