From e45997b7ce87bb5960e2e45c1c65771b1da92ea5 Mon Sep 17 00:00:00 2001 From: Bradley Koby Date: Fri, 17 Jun 2016 11:33:11 -0400 Subject: [PATCH 1/2] Add map to template --- manifests/init.pp | 2 +- manifests/params.pp | 2 +- templates/nslcd.erb | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 6aa8af6..7d45dbb 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -20,6 +20,7 @@ class nslcd ( $ldap_search_base = $nslcd::params::ldap_search_base, $ldap_search_scope = $nslcd::params::ldap_search_scope, $ldap_filters = $nslcd::params::ldap_filters, + $ldap_maps = $nslcd::params::ldap_maps, $ldap_ssl = $nslcd::params::ldap_ssl, $ldap_tls_reqcert = $nslcd::params::ldap_tls_reqcert, $ldap_tls_cacertfile = $nslcd::params::ldap_tls_cacertfile, @@ -43,4 +44,3 @@ class nslcd ( anchor { 'nslcd::end': } } - diff --git a/manifests/params.pp b/manifests/params.pp index 4aca72e..484311b 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -14,6 +14,7 @@ class nslcd::params { $ldap_search_base = '' $ldap_search_scope = 'subtree' $ldap_filters = {} + $ldap_maps = {} $ldap_ssl = 'off' $ldap_tls_reqcert = 'allow' $ldap_tls_cacertfile = undef @@ -49,4 +50,3 @@ class nslcd::params { } } - diff --git a/templates/nslcd.erb b/templates/nslcd.erb index f6fcdf1..b90b872 100644 --- a/templates/nslcd.erb +++ b/templates/nslcd.erb @@ -38,3 +38,10 @@ scope <%= @ldap_search_scope %> filter <%= map %> <%= filter %> <% end -%> <% end -%> + +<% if @ldap_maps.length > 0 -%> +# Custom maps +<% @ldap_maps.each do |key, value| -%> +map <%= key %> <%= value %> +<% end -%> +<% end -%> From 3dbff6a66d9afb39bf6b0baaa6569c8dd8f0db8a Mon Sep 17 00:00:00 2001 From: Bradley Koby Date: Fri, 17 Jun 2016 11:43:47 -0400 Subject: [PATCH 2/2] Add other options --- manifests/init.pp | 1 + manifests/params.pp | 1 + templates/nslcd.erb | 8 ++++++++ 3 files changed, 10 insertions(+) diff --git a/manifests/init.pp b/manifests/init.pp index 7d45dbb..3f8402e 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -19,6 +19,7 @@ class nslcd ( $ldap_bindpw = $nslcd::params::ldap_bindpw, $ldap_search_base = $nslcd::params::ldap_search_base, $ldap_search_scope = $nslcd::params::ldap_search_scope, + $config_options = $nslcd::params::config_options, $ldap_filters = $nslcd::params::ldap_filters, $ldap_maps = $nslcd::params::ldap_maps, $ldap_ssl = $nslcd::params::ldap_ssl, diff --git a/manifests/params.pp b/manifests/params.pp index 484311b..9bd989d 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -13,6 +13,7 @@ class nslcd::params { $ldap_bindpw = undef $ldap_search_base = '' $ldap_search_scope = 'subtree' + $config_options = {} $ldap_filters = {} $ldap_maps = {} $ldap_ssl = 'off' diff --git a/templates/nslcd.erb b/templates/nslcd.erb index b90b872..7e369fe 100644 --- a/templates/nslcd.erb +++ b/templates/nslcd.erb @@ -32,6 +32,14 @@ tls_cacertfile <%= @ldap_tls_cacertfile %> # The search scope. scope <%= @ldap_search_scope %> +<% @config_options.sort.each do |k,v| -%> +<% Array(v).each do |av| -%> +<% if ![nil, '', :undef].include?(av) -%> +<%= %Q(#{k} #{av}) %> +<% end -%> +<% end -%> +<% end -%> + <% if @ldap_filters.length > 0 -%> # Custom search filters <% @ldap_filters.each do |map, filter| -%>