diff options
author | Michael Scherer <misc@mageia.org> | 2012-01-22 22:53:46 +0000 |
---|---|---|
committer | Michael Scherer <misc@mageia.org> | 2012-01-22 22:53:46 +0000 |
commit | db6291a361eb3f54a6d4c16b3ddc38d87c660117 (patch) | |
tree | 61cbd3c553a4d2f6fc3e72c88df6756f420008bb | |
parent | b837592ebb5e9082419875e36d9070ee3d48214c (diff) | |
download | puppet-db6291a361eb3f54a6d4c16b3ddc38d87c660117.tar puppet-db6291a361eb3f54a6d4c16b3ddc38d87c660117.tar.gz puppet-db6291a361eb3f54a6d4c16b3ddc38d87c660117.tar.bz2 puppet-db6291a361eb3f54a6d4c16b3ddc38d87c660117.tar.xz puppet-db6291a361eb3f54a6d4c16b3ddc38d87c660117.zip |
add the function get_ldap_servers to get all ldap servers ( and
so to automatically add any slave we add later )
-rw-r--r-- | modules/openldap/lib/puppet/parser/functions/get_ldap_servers.rb | 13 | ||||
-rw-r--r-- | modules/openldap/manifests/init.pp | 8 |
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 |