-
Notifications
You must be signed in to change notification settings - Fork 0
/
params.pp
167 lines (146 loc) · 5.32 KB
/
params.pp
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# File:: <tt>bind-params.pp</tt>
# Author:: Sebastien Varrette ([email protected])
# Copyright:: Copyright (c) 2011 Sebastien Varrette
# License:: GPL v3
#
# ------------------------------------------------------------------------------
# = Class: bind::params
#
# In this class are defined as variables values that are used in other
# bind classes.
# This class should be included, where necessary, and eventually be enhanced
# with support for more OS
#
# == Warnings
#
# /!\ Always respect the style guide available
# here[http://docs.puppetlabs.com/guides/style_guide]
#
# The usage of a dedicated param classe is advised to better deal with
# parametrized classes, see
# http://docs.puppetlabs.com/guides/parameterized_classes.html
#
# [Remember: No empty lines between comments and class definition]
#
class bind::params {
######## DEFAULTS FOR VARIABLES USERS CAN SET ##########################
# (Here are set the defaults, provide your custom variables externally)
# (The default used is in the line with '')
###########################################
# ensure the presence (or absence) of bind
$ensure = 'present'
# The Protocol used. Used by monitor and firewall class. Default is 'tcp'
$protocol = 'tcp'
# The port number. Used by monitor and firewall class. The default is 22.
$port = 53
# Define global forwarders. Can be an array
$forwarders = [ '10.21.0.5' ]
# clients authorized for querying the server; can be an array
$allow_query = ''
# enable or disable dnssec, disabled by default
$dnssec = false
#### MODULE INTERNAL VARIABLES #########
# (Modify to adapt to unsupported OSes)
#######################################
if ($facts['os']['family'] == 'RedHat' and Integer($facts['os']['release']['major']) <= 7) {
$support_rsyslog = false
} else {
$support_rsyslog = true
}
# Packages to install
$packagename = $facts['os']['name'] ? {
/(?i-mx:ubuntu|debian)/ => 'bind9',
/(?i-mx:centos|redhat|rocky|fedora)/ => 'bind-chroot',
default => 'bind',
}
$utils_packages = $facts['os']['name'] ? {
/(?i-mx:ubuntu|debian)/ => [ 'nslint' ],
default => [],
}
# The User running bind
$user = $facts['os']['name'] ? {
/(?i-mx:ubuntu|debian)/ => 'bind',
default => 'named',
}
$group = $user
# Bind (aka DNS) service
$servicename = $facts['os']['name'] ? {
/(?i-mx:ubuntu|debian)/ => 'bind9',
/(?i-mx:centos|redhat|rocky|fedora)/ => 'named-chroot',
default => 'named'
}
# used for pattern in a service ressource
$processname = $facts['os']['name'] ? {
default => 'named',
}
$hasstatus = $facts['os']['name'] ? {
/(?i-mx:ubuntu|debian)/ => false,
/(?i-mx:centos|fedora|redhat|rocky)/ => true,
default => true,
}
$hasrestart = $facts['os']['name'] ? {
default => true,
}
# Chroot dir
$chrootdir = $facts['os']['name'] ? {
/(?i-mx:ubuntu|debian)/ => '/var/chroot/bind',
/(?i-mx:centos|fedora|redhat|rocky)/ => '/var/named/chroot',
default => '/var/chroot/bind'
}
# Configuration directory
$configdir = $facts['os']['name'] ? {
/(?i-mx:ubuntu|debian)/ => "${chrootdir}/etc/bind",
/(?i-mx:centos|fedora|redhat|rocky)/ => '/etc/named',
default => '/etc/bind'
}
$configdir_mode = $facts['os']['name'] ? {
default => '0755',
}
# Bind main configuration file
$configfile = $facts['os']['name'] ? {
/(?i-mx:ubuntu|debian)/ => "${chrootdir}/etc/bind/named.conf",
/(?i-mx:centos|fedora|redhat|rocky)/ => '/etc/named.conf',
default => '/etc/bind/named.conf'
}
$configfile_mode = $facts['os']['name'] ? {
default => '0644',
}
$configfile_owner = $facts['os']['name'] ? {
default => $user,
}
$configfile_group = $facts['os']['name'] ? {
default => $group,
}
# named.conf.local
$localconfigfile = $facts['os']['name'] ? {
default => "${configdir}/named.conf.local"
}
# named.conf.default_zones
$default_zones_file = $facts['os']['name'] ? {
default => "${configdir}/named.conf.default-zones"
}
# named.conf.options
$optionsfile = $facts['os']['name'] ? {
default => "${configdir}/named.conf.options"
}
#init.d default config file
$initconfigfile = $facts['os']['name'] ? {
/(?i-mx:ubuntu|debian)/ => '/etc/default/bind9',
default => '/etc/sysconfig/named',
}
# Base directory for Bind
$basedir = $facts['os']['name'] ? {
/(?i-mx:ubuntu|debian)/ => '/var/cache/bind',
default => '/var/named',
}
# PID file
$pidfile = $facts['os']['name'] ? {
/(?i-mx:ubuntu|debian)/ => '/var/run/bind/named.pid',
/(?i-mx:centos|fedora|redhat|rocky)/ => '/run/named/named.pid',
default => '/var/run/named.pid',
}
# Log dir (log file will be ${logdir}/bind.log
$logdir = $facts['os']['name'] ? {
default => '/var/log',
}
}