aboutsummaryrefslogtreecommitdiffstats
path: root/modules/openldap
diff options
context:
space:
mode:
Diffstat (limited to 'modules/openldap')
-rw-r--r--modules/openldap/lib/puppet/parser/functions/get_ldap_servers.rb13
-rw-r--r--modules/openldap/manifests/init.pp8
2 files changed, 21 insertions, 0 deletions
diff --git a/modules/openldap/lib/puppet/parser/functions/get_ldap_servers.rb b/modules/openldap/lib/puppet/parser/functions/get_ldap_servers.rb
new file mode 100644
index 00000000..ce9ec1b1
--- /dev/null
+++ b/modules/openldap/lib/puppet/parser/functions/get_ldap_servers.rb
@@ -0,0 +1,13 @@
+# return a list of all ldap servers declared
+module Puppet::Parser::Functions
+ newfunction(:get_ldap_servers, :type => :rvalue) do |args|
+ Puppet::Parser::Functions.autoloader.loadall
+ res = ["master"]
+
+ function_list_exported_ressources(['Openldap::Exported_slave']).each { |i|
+ res << "slave-#{i}"
+ }
+ res.map! { |x| "ldap-#{x}." + lookupvar("domain") }
+ return res.join(" ")
+ end
+end
diff --git a/modules/openldap/manifests/init.pp b/modules/openldap/manifests/init.pp
index cc432f39..4f2c2d33 100644
--- a/modules/openldap/manifests/init.pp
+++ b/modules/openldap/manifests/init.pp
@@ -76,6 +76,12 @@ class openldap {
}
}
+ # this define is here only to be exported by slave
+ # and later used by get_ldap_servers
+ define exported_slave {
+
+ }
+
# TODO create the user for sync in ldap
# syntaxic sugar
define slave_instance($rid) {
@@ -88,6 +94,8 @@ class openldap {
class slave($rid) inherits common {
+ @@openldap::exported_slave { $rid: }
+
$sync_password = extlookup("ldap_syncuser-$hostname",'x')
# same access rights as master