From 425ad79683e59603f83e6484a2e32804273d4339 Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Fri, 10 Mar 2017 18:19:04 -0500 Subject: implement ensure absent for postfix::config This does not have a special case for "non-standard" settings, since I don't know whether it is needed or not. --- README.md | 11 ++++++++++- manifests/config.pp | 4 +++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7a6b01f..c7646a9 100644 --- a/README.md +++ b/README.md @@ -122,9 +122,13 @@ Convience classes postfix::config --------------- -this can be used to pass arbitrary postfix configurations by passing the $name +This can be used to pass arbitrary postfix configurations by passing the $name to postconf to add/alter/remove options in main.cf +It can also be used to ensure that a certain configuration is not present by +setting the ensure parameter to absent. In this case, the value parameter is +still mandatory but can be set to whatever value. + Parameters: - *name*: name of the parameter. - *ensure*: present/absent. defaults to present. @@ -144,6 +148,11 @@ Example usage: "relayhost" => "[mail.example.com]:587"; } + postfix::config { 'smtp_tls_cert_file': + ensure => absent, + value => '', + } + postfix::disable ---------------- diff --git a/manifests/config.pp b/manifests/config.pp index ce7af9e..a1eb651 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -43,7 +43,9 @@ define postfix::config ($ensure = present, $value, $nonstandard = false) { } absent: { - fail "postfix::config ensure => absent: Not implemented" + exec { "postconf -X ${name}": + unless => "test \"x$(postconf -n ${name})\" = \"x\"", + } } } } -- cgit v1.2.3 From a090ecdc080e25233c6d62512ee800506e0d0159 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Mon, 8 Jan 2018 14:08:49 +0000 Subject: master.cf: on Debian Stretch that ships dovecot 2.x, don't pass obsolete -n, but instead -a "${recipient}" (#13) Same as commit 3ee64eb, applied to the debian-9 template. --- templates/master.cf.debian-9.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/master.cf.debian-9.erb b/templates/master.cf.debian-9.erb index 397c089..e96f657 100644 --- a/templates/master.cf.debian-9.erb +++ b/templates/master.cf.debian-9.erb @@ -148,7 +148,7 @@ amavis unix - - - - 2 smtp <% end %> <% if @use_dovecot_lda == 'yes' %> dovecot unix - n n - - pipe - flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop} -n -m ${extension} + flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop} -m ${extension} -a "${recipient}" <% end %> <% if @use_schleuder == 'yes' %> schleuder unix - n n - - pipe -- cgit v1.2.3 From 6743a08b90a118130edd3e59449c5b389fb1796e Mon Sep 17 00:00:00 2001 From: intrigeri Date: Tue, 9 Jan 2018 21:26:22 +0000 Subject: Remove obsolete ensure parameter for concat::fragment. Recent versions of the concat module error out when one passes an ensure parameter. --- manifests/header_checks_snippet.pp | 3 --- manifests/tlspolicy_snippet.pp | 8 +++----- manifests/transport_regexp_snippet.pp | 7 ++----- manifests/virtual_regexp_snippet.pp | 7 ++----- 4 files changed, 7 insertions(+), 18 deletions(-) diff --git a/manifests/header_checks_snippet.pp b/manifests/header_checks_snippet.pp index 05929a3..4c8df86 100644 --- a/manifests/header_checks_snippet.pp +++ b/manifests/header_checks_snippet.pp @@ -6,7 +6,6 @@ See the postfix::header_checks class for details. Parameters: - *source* or *content*: source or content of the header_checks snippet -- *ensure*: present (default) or absent Requires: - Class["postfix"] @@ -24,7 +23,6 @@ Example usage: */ define postfix::header_checks_snippet ( - $ensure = "present", $source = '', $content = undef ) { @@ -42,7 +40,6 @@ define postfix::header_checks_snippet ( $fragment = "postfix_header_checks_${name}" concat::fragment { "$fragment": - ensure => "$ensure", target => '/etc/postfix/header_checks', } diff --git a/manifests/tlspolicy_snippet.pp b/manifests/tlspolicy_snippet.pp index b63f812..77fc457 100644 --- a/manifests/tlspolicy_snippet.pp +++ b/manifests/tlspolicy_snippet.pp @@ -7,7 +7,6 @@ See the postfix::tlspolicy class for details. Parameters: - *name*: name of destination domain Postfix will lookup. See TLS_README. - *value*: right-hand part of the tls_policy map -- *ensure*: present/absent, defaults to present. Requires: - Class["postfix"] @@ -28,16 +27,15 @@ Example usage: */ -define postfix::tlspolicy_snippet ($ensure="present", $value = false) { +define postfix::tlspolicy_snippet ($value = false) { - if ($value == false) and ($ensure == "present") { - fail("The value parameter must be set when using the postfix::tlspolicy_snippet define with ensure=present.") + if $value == false { + fail("The value parameter must be set when using the postfix::tlspolicy_snippet define.") } include postfix::tlspolicy concat::fragment { "postfix_tlspolicy_${name}": - ensure => "$ensure", content => "${name} ${value}\n", target => "$postfix::tlspolicy::postfix_merged_tlspolicy", } diff --git a/manifests/transport_regexp_snippet.pp b/manifests/transport_regexp_snippet.pp index 2b13ed1..9d37f2b 100644 --- a/manifests/transport_regexp_snippet.pp +++ b/manifests/transport_regexp_snippet.pp @@ -6,7 +6,6 @@ See the postfix::transport_regexp class for details. Parameters: - *source* or *content*: source or content of the transport_regexp snippet -- *ensure*: present (default) or absent Requires: - Class["postfix"] @@ -24,7 +23,6 @@ Example usage: */ define postfix::transport_regexp_snippet ( - $ensure = "present", $source = '', $content = undef ) { @@ -37,8 +35,8 @@ define postfix::transport_regexp_snippet ( fail("Only one of \$source or \$content must specified for postfix::transport_regexp_snippet ${name}") } - if ($value == false) and ($ensure == "present") { - fail("The value parameter must be set when using the postfix::transport_regexp_snippet define with ensure=present.") + if $value == false { + fail("The value parameter must be set when using the postfix::transport_regexp_snippet define.") } include postfix::transport_regexp @@ -46,7 +44,6 @@ define postfix::transport_regexp_snippet ( $snippetfile = "${postfix::transport_regexp::postfix_transport_regexp_snippets_dir}/${name}" file { "$snippetfile": - ensure => "$ensure", mode => 600, owner => root, group => 0, diff --git a/manifests/virtual_regexp_snippet.pp b/manifests/virtual_regexp_snippet.pp index bd9a982..e6202df 100644 --- a/manifests/virtual_regexp_snippet.pp +++ b/manifests/virtual_regexp_snippet.pp @@ -6,7 +6,6 @@ See the postfix::virtual_regexp class for details. Parameters: - *source* or *content*: source or content of the virtual_regexp snippet -- *ensure*: present (default) or absent Requires: - Class["postfix"] @@ -24,7 +23,6 @@ Example usage: */ define postfix::virtual_regexp_snippet ( - $ensure = "present", $source = '', $content = undef ) { @@ -37,8 +35,8 @@ define postfix::virtual_regexp_snippet ( fail("Only one of \$source or \$content must specified for postfix::virtual_regexp_snippet ${name}") } - if ($value == false) and ($ensure == "present") { - fail("The value parameter must be set when using the postfix::virtual_regexp_snippet define with ensure=present.") + if $value == false { + fail("The value parameter must be set when using the postfix::virtual_regexp_snippet define.") } include postfix::virtual_regexp @@ -46,7 +44,6 @@ define postfix::virtual_regexp_snippet ( $snippetfile = "${postfix::virtual_regexp::postfix_virtual_regexp_snippets_dir}/${name}" file { "$snippetfile": - ensure => "$ensure", mode => 600, owner => root, group => 0, -- cgit v1.2.3