Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native support for storing bind_pw in hiera; ldap_options is now more flexible. #332

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
#
# [*ldap_host*] - (string)
#
# [*ldap_bind_pw*] - (string)
#
# [*ldap_options*] - (string)
#
# [*mail_user*] - (string) The mail user
Expand Down Expand Up @@ -126,7 +128,8 @@
Boolean $ldap = false,
Optional[String] $ldap_base = undef,
Optional[String] $ldap_host = undef,
Optional[String] $ldap_options = undef,
Optional[String] $ldap_bind_pw = undef,
Optional[Variant[String,Array[String]]] $ldap_options = undef,
String $mail_user = 'vmail', # postfix_mail_user
Boolean $mailman = false,
String $maincf_source = "puppet:///modules/${module_name}/main.cf",
Expand Down
7 changes: 5 additions & 2 deletions manifests/ldap.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
class postfix::ldap {
assert_type(String, $postfix::ldap_base)
assert_type(String, $postfix::ldap_host)
assert_type(String, $postfix::ldap_options)
assert_type(Optional[String], $postfix::ldap_bind_pw)
assert_type(Optional[Variant[String,Array[String]]], $postfix::ldap_options)

if $facts['os']['family'] == 'Debian' {
if $facts['os']['family'] in ['Debian','RedHat'] {
package { 'postfix-ldap':
before => File["${postfix::confdir}/ldap-aliases.cf"],
}
Expand All @@ -28,6 +29,8 @@
fail 'Missing $postfix::ldap_base !'
}

$ldap_bind_pw = $postfix::ldap_bind_pw

$ldap_host = $postfix::ldap_host ? {
undef => 'localhost',
default => $postfix::ldap_host,
Expand Down
9 changes: 8 additions & 1 deletion templates/postfix-ldap-aliases.cf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,11 @@ server_host = <%= @ldap_host %>
<% if @ldap_base -%>
search_base = <%= @ldap_base %>
<% end -%>
<%= @ldap_options %>
<%
options = [ @ldap_options ].flatten
if @ldap_bind_pw
options.append('bind_pw = ' + @ldap_bind_pw )
end
if options -%>
<%= options.sort.join("\n") %>
<% end -%>