Skip to content

Commit 8289129

Browse files
committed
Eliminate params.pp
params.pp and Inheritance in general is not best Practice anymore. Hiera provides better Definition of Parameters. - move Defaultvalues to Modulelevel-Hiera - eliminate params.pp - sort YAML-Files alphabetically
1 parent 9e812b8 commit 8289129

25 files changed

+197
-222
lines changed

REFERENCE.md

Lines changed: 35 additions & 81 deletions
Large diffs are not rendered by default.

data/common.yaml

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,46 @@
11
---
2-
postfix::params::aliasesseltype: ~
3-
postfix::params::seltype: ~
4-
postfix::params::mailx_package: 'mailx'
5-
postfix::params::master_os_template: "postfix/master.cf.default.erb"
6-
postfix::params::restart_cmd: '/etc/init.d/postfix reload'
7-
...
2+
postfix::alias_maps: hash:/etc/aliases
3+
postfix::amavis_procs: 2
4+
postfix::confdir: "/etc/postfix"
5+
postfix::conffiles: {}
6+
postfix::configs: {}
7+
postfix::hashes: {}
8+
postfix::inet_interfaces: all
9+
postfix::inet_protocols: all
10+
postfix::ldap: false
11+
postfix::ldap_packages: []
12+
postfix::lookup_table_type: hash
13+
postfix::mail_user: vmail
14+
postfix::mailaliases: {}
15+
postfix::mailman: false
16+
postfix::mailx_ensure: present
17+
postfix::mailx_package: mailx
18+
postfix::maincf_source: puppet:///modules/postfix/main.cf
19+
postfix::manage_aliases: true
20+
postfix::manage_conffiles: true
21+
postfix::manage_mailname: true
22+
postfix::manage_mailx: true
23+
postfix::manage_root_alias: true
24+
postfix::maps: {}
25+
postfix::master_bounce_command: bounce
26+
postfix::master_defer_command: bounce
27+
postfix::master_entries: []
28+
postfix::master_os_template: postfix/master.cf.default.erb
29+
postfix::mta: false
30+
postfix::mydestination: "$myhostname, localhost.$mydomain, localhost"
31+
postfix::mynetworks: 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
32+
postfix::myorigin: "%{facts.networking.fqdn}"
33+
postfix::postfix_ensure: present
34+
postfix::restart_cmd: "/etc/init.d/postfix reload"
35+
postfix::root_group: root
36+
postfix::root_mail_recipient: nobody
37+
postfix::satellite: false
38+
postfix::service_enabled: true
39+
postfix::service_ensure: running
40+
postfix::smtp_listen: 127.0.0.1
41+
postfix::transports: {}
42+
postfix::use_amavisd: false
43+
postfix::use_dovecot_lda: false
44+
postfix::use_schleuder: false
45+
postfix::use_sympa: false
46+
postfix::virtuals: {}

data/os/Alpine.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
postfix::params::master_os_template: "postfix/master.cf.debian.erb"
2+
postfix::master_os_template: postfix/master.cf.debian.erb

data/os/FreeBSD.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
postfix::confdir: "/usr/local/etc/postfix"
33
postfix::manage_mailname: false
44
postfix::manage_mailx: false
5-
postfix::root_group: "wheel"
6-
postfix::params::master_os_template: "postfix/master.cf.FreeBSD.erb"
7-
postfix::params::restart_cmd: "/usr/local/etc/rc.d/postfix reload"
8-
...
5+
postfix::master_os_template: postfix/master.cf.FreeBSD.erb
6+
postfix::restart_cmd: "/usr/local/etc/rc.d/postfix reload"
7+
postfix::root_group: wheel

data/os/Solaris.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
postfix::params::master_os_template: "postfix/master.cf.Solaris.erb"
3-
postfix::params::restart_cmd: '/usr/sbin/svcadm refresh network/smtp:postfix'
4-
postfix::params::mailx_package: 'mailx'
5-
...
2+
postfix::mailx_package: mailx
3+
postfix::master_os_template: postfix/master.cf.Solaris.erb
4+
postfix::restart_cmd: "/usr/sbin/svcadm refresh network/smtp:postfix"

data/osfamily/Debian.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
postfix::params::mailx_package: 'bsd-mailx'
3-
postfix::params::master_os_template: 'postfix/master.cf.debian.erb'
4-
postfix::ldap_packages: ['postfix-ldap']
5-
...
2+
postfix::ldap_packages:
3+
- postfix-ldap
4+
postfix::mailx_package: bsd-mailx
5+
postfix::master_os_template: postfix/master.cf.debian.erb

data/osfamily/Debian/etch.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
---
2-
postfix::params::mailx_package: 'mailx'
3-
...
2+
postfix::mailx_package: mailx

data/osfamily/Debian/lenny.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
---
2-
postfix::params::mailx_package: 'mailx'
3-
...
2+
postfix::mailx_package: mailx

data/osfamily/Debian/sarge.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
---
2-
postfix::params::mailx_package: 'mailx'
3-
...
2+
postfix::mailx_package: mailx

data/osfamily/RedHat.yaml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
2-
postfix::params::aliasesseltype: 'etc_aliases_t'
3-
postfix::params::seltype: 'postfix_etc_t'
4-
postfix::params::restart_cmd: '/bin/systemctl reload postfix'
5-
postfix::params::master_os_template: 'postfix/master.cf.redhat.erb'
6-
postfix::mta_bin_path: '/usr/sbin/sendmail.postfix'
7-
...
2+
postfix::aliasesseltype: etc_aliases_t
3+
postfix::master_os_template: postfix/master.cf.redhat.erb
4+
postfix::mta_bin_path: "/usr/sbin/sendmail.postfix"
5+
postfix::restart_cmd: "/bin/systemctl reload postfix"
6+
postfix::seltype: postfix_etc_t

data/osfamily/RedHat/10.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
2-
postfix::alias_maps: 'lmdb:/etc/aliases'
3-
postfix::ldap_packages: ['postfix-ldap']
4-
postfix::lookup_table_type: 'lmdb'
5-
postfix::params::mailx_package: 's-nail'
2+
postfix::alias_maps: lmdb:/etc/aliases
3+
postfix::ldap_packages:
4+
- postfix-ldap
5+
postfix::lookup_table_type: lmdb
6+
postfix::mailx_package: s-nail

data/osfamily/RedHat/4.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
postfix::params::aliasesseltype: 'etc_t'
3-
postfix::params::seltype: 'etc_t'
4-
postfix::params::restart_cmd: '/etc/init.d/postfix reload'
5-
...
2+
postfix::aliasesseltype: etc_t
3+
postfix::restart_cmd: "/etc/init.d/postfix reload"
4+
postfix::seltype: etc_t

data/osfamily/RedHat/5.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
---
2-
postfix::params::aliasesseltype: 'postfix_etc_t'
3-
postfix::params::restart_cmd: '/etc/init.d/postfix reload'
4-
...
2+
postfix::aliasesseltype: postfix_etc_t
3+
postfix::restart_cmd: "/etc/init.d/postfix reload"

data/osfamily/RedHat/6.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
---
2-
postfix::params::restart_cmd: '/etc/init.d/postfix reload'
3-
...
2+
postfix::restart_cmd: "/etc/init.d/postfix reload"

data/osfamily/RedHat/9.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
2-
3-
postfix::params::mailx_package: 's-nail'
4-
postfix::ldap_packages: ['postfix-ldap']
2+
postfix::ldap_packages:
3+
- postfix-ldap
4+
postfix::mailx_package: s-nail

manifests/conffile.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
mode => $mode,
9393
owner => 'root',
9494
group => 'postfix',
95-
seltype => $postfix::params::seltype,
95+
seltype => $postfix::seltype,
9696
require => Package['postfix'],
9797
source => $source,
9898
content => $manage_content,

manifests/files.pp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
ensure => 'file',
5252
content => "${facts['networking']['fqdn']}\n",
5353
mode => '0644',
54-
seltype => $postfix::params::seltype,
54+
seltype => $postfix::seltype,
5555
}
5656
}
5757

@@ -62,7 +62,7 @@
6262
content => "# file managed by puppet\n",
6363
notify => Exec['newaliases'],
6464
replace => false,
65-
seltype => $postfix::params::aliasesseltype,
65+
seltype => $postfix::aliasesseltype,
6666
}
6767
}
6868

@@ -75,7 +75,7 @@
7575
$_mastercf_content = epp($mastercf_template)
7676
} else {
7777
$_mastercf_content = template(
78-
$postfix::params::master_os_template,
78+
$postfix::master_os_template,
7979
'postfix/master.cf.common.erb'
8080
)
8181
}
@@ -86,7 +86,7 @@
8686
group => $postfix::root_group,
8787
mode => '0644',
8888
owner => 'root',
89-
seltype => $postfix::params::seltype,
89+
seltype => $postfix::seltype,
9090
source => $mastercf_source,
9191
}
9292

@@ -97,7 +97,7 @@
9797
mode => '0644',
9898
owner => 'root',
9999
replace => false,
100-
seltype => $postfix::params::seltype,
100+
seltype => $postfix::seltype,
101101
source => $maincf_source,
102102
}
103103

manifests/hash.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
Optional[Variant[Sensitive[String],String]] $content = undef,
4949
Stdlib::Filemode $mode = '0640',
5050
) {
51-
include postfix::params
51+
include postfix
5252

5353
assert_type(Stdlib::Absolutepath, $name)
5454

manifests/init.pp

Lines changed: 68 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@
136136
# @param manage_mailx
137137
# A Boolean defining whether the puppet module should manage the mailx package. See also $mailx_ensure.
138138
#
139+
# @param mailx_package
140+
# Name of package that provides mailx
141+
#
139142
# @param manage_root_alias
140143
# Wheter to manage the mailalias for root user
141144
#
@@ -148,6 +151,9 @@
148151
# @param master_defer_command
149152
# The defer command which should be used in master.cf
150153
#
154+
# @param master_os_template
155+
# Path to the master template
156+
#
151157
# @param master_entries
152158
# Array of strings containing additional entries for the /etc/postfix/master.cf file.
153159
# Example: `['submission inet n - n - - smtpd']`.
@@ -235,6 +241,9 @@
235241
# @param service_ensure
236242
# Defines the service state of 'postfix' service
237243
#
244+
# @param restart_cmd
245+
# Command to use when restarting postfix
246+
#
238247
# @param smtp_listen
239248
# A string or an array of strings to define the IPs on which to listen in master.cf.
240249
# This can also be set to 'all' to listen on all interfaces. If master_smtp is defined
@@ -260,65 +269,77 @@
260269
# @param virtuals
261270
# A hash of postfix::virtual resources
262271
#
272+
# @param aliasesseltype
273+
# Selinux type for /etc/aliases
274+
#
275+
# @param seltype
276+
# Selinux type for /etc/postfix/* config files
277+
#
263278
class postfix (
264-
String $alias_maps = 'hash:/etc/aliases',
265-
Integer $amavis_procs = 2,
279+
String $alias_maps,
280+
Integer $amavis_procs,
281+
Stdlib::Absolutepath $confdir,
282+
Hash $conffiles,
283+
Hash $configs,
284+
Hash $hashes,
285+
String $inet_interfaces,
286+
String $inet_protocols,
287+
Boolean $ldap,
288+
Array[String[1]] $ldap_packages,
289+
String $lookup_table_type,
290+
Hash $mailaliases,
291+
String $mail_user, # postfix_mail_user
292+
Boolean $mailman,
293+
String $mailx_ensure,
294+
String $mailx_package,
295+
String $maincf_source,
296+
Boolean $manage_aliases, # /etc/aliases
297+
Boolean $manage_conffiles,
298+
Boolean $manage_mailname,
299+
Boolean $manage_mailx,
300+
Boolean $manage_root_alias,
301+
Hash $maps,
302+
String $master_bounce_command,
303+
String $master_defer_command,
304+
String $master_os_template,
305+
Array[String] $master_entries, # postfix_master_entries
306+
Boolean $mta,
307+
String $mydestination, # postfix_mydestination
308+
String $mynetworks, # postfix_mynetworks
309+
String $myorigin,
310+
String $postfix_ensure,
311+
String $root_group,
312+
Variant[Array[String], String] $root_mail_recipient, # root_mail_recipient
313+
Boolean $satellite,
314+
Boolean $service_enabled,
315+
String $service_ensure,
316+
String $restart_cmd,
317+
Variant[Array[String[1]], String[1]] $smtp_listen, # postfix_smtp_listen
318+
Hash $transports,
319+
Boolean $use_amavisd, # postfix_use_amavisd
320+
Boolean $use_dovecot_lda, # postfix_use_dovecot_lda
321+
Variant[Integer[2, 3], Boolean] $use_schleuder, # postfix_use_schleuder
322+
Boolean $use_sympa, # postfix_use_sympa
323+
Hash $virtuals,
324+
266325
Optional[Boolean] $chroot = undef,
267-
Stdlib::Absolutepath $confdir = '/etc/postfix',
268-
Hash $conffiles = {},
269-
Hash $configs = {},
270-
Hash $hashes = {},
271-
String $inet_interfaces = 'all',
272-
String $inet_protocols = 'all',
273-
Boolean $ldap = false,
274326
Optional[String] $ldap_base = undef,
275327
Optional[String] $ldap_host = undef,
276328
Optional[String] $ldap_options = undef,
277-
Array[String[1]] $ldap_packages = [],
278-
String $lookup_table_type = 'hash',
279-
Hash $mailaliases = {},
280-
String $mail_user = 'vmail', # postfix_mail_user
281-
Boolean $mailman = false,
282-
String $mailx_ensure = 'present',
283-
String $maincf_source = "puppet:///modules/${module_name}/main.cf",
284-
Boolean $manage_aliases = true, # /etc/aliases
285-
Boolean $manage_conffiles = true,
286-
Boolean $manage_mailname = true,
287-
Boolean $manage_mailx = true,
288-
Boolean $manage_root_alias = true,
289-
Hash $maps = {},
290-
String $master_bounce_command = 'bounce',
291-
String $master_defer_command = 'bounce',
292-
Array[String] $master_entries = [], # postfix_master_entries
293-
Optional[String] $master_smtp = undef, # postfix_master_smtp
294-
Optional[String] $master_smtps = undef, # postfix_master_smtps
295-
Optional[String] $master_submission = undef, # postfix_master_submission
329+
Optional[String] $master_smtp = undef, # postfix_master_smtp
330+
Optional[String] $master_smtps = undef, # postfix_master_smtps
331+
Optional[String] $master_submission = undef, # postfix_master_submission
296332
Optional[String] $mastercf_content = undef,
297333
Optional[String] $mastercf_source = undef,
298334
Optional[String] $mastercf_template = undef,
299335
Optional[Array[String[1]]] $masquerade_classes = undef,
300336
Optional[Array[String[1]]] $masquerade_domains = undef,
301337
Optional[Array[String[1]]] $masquerade_exceptions = undef,
302338
Optional[Stdlib::Absolutepath] $mta_bin_path = undef,
303-
Boolean $mta = false,
304-
String $mydestination = '$myhostname, localhost.$mydomain, localhost', # postfix_mydestination
305-
String $mynetworks = '127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128', # postfix_mynetworks
306-
String $myorigin = $facts['networking']['fqdn'],
307-
String $postfix_ensure = 'present',
308-
Optional[String] $relayhost = undef, # postfix_relayhost
309-
String $root_group = 'root',
310-
Variant[Array[String], String] $root_mail_recipient = 'nobody', # root_mail_recipient
311-
Boolean $satellite = false,
312-
Boolean $service_enabled = true,
313-
String $service_ensure = 'running',
314-
Variant[Array[String[1]], String[1]] $smtp_listen = '127.0.0.1', # postfix_smtp_listen
315-
Hash $transports = {},
316-
Boolean $use_amavisd = false, # postfix_use_amavisd
317-
Boolean $use_dovecot_lda = false, # postfix_use_dovecot_lda
318-
Variant[Integer[2, 3], Boolean] $use_schleuder = false, # postfix_use_schleuder
319-
Boolean $use_sympa = false, # postfix_use_sympa
320-
Hash $virtuals = {},
321-
) inherits postfix::params {
339+
Optional[String] $relayhost = undef, # postfix_relayhost
340+
Optional[String] $aliasesseltype = undef,
341+
Optional[String] $seltype = undef,
342+
) {
322343
if (
323344
($mastercf_source and $mastercf_content) or
324345
($mastercf_source and $mastercf_template) or

manifests/map.pp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
Stdlib::Filemode $mode = '0640',
4444
) {
4545
include postfix
46-
include postfix::params
4746

4847
$_path = pick($path, "${postfix::confdir}/${name}")
4948

manifests/packages.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
if ($postfix::manage_mailx) {
1313
package { 'mailx':
1414
ensure => $postfix::mailx_ensure,
15-
name => $postfix::params::mailx_package,
15+
name => $postfix::mailx_package,
1616
}
1717
}
1818
}

0 commit comments

Comments
 (0)