From 51ab750fa5b84edd34d50d898f12aa1d2032950c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Mon, 18 Sep 2017 00:16:05 +0200 Subject: Add ips to LDAP --- modules/base_installation/manifests/puppet.pp | 1 + .../templates/puppet/host_ldap.info.erb | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) (limited to 'modules/base_installation') diff --git a/modules/base_installation/manifests/puppet.pp b/modules/base_installation/manifests/puppet.pp index 6ad4b22..a8dc641 100644 --- a/modules/base_installation/manifests/puppet.pp +++ b/modules/base_installation/manifests/puppet.pp @@ -55,6 +55,7 @@ class base_installation::puppet ( require => File[$base_installation::puppet_conf_path], } + $ips = lookup("ips") |$key| { {} } file { "$base_installation::puppet_conf_path/host_ldap.info": content => template("base_installation/puppet/host_ldap.info.erb"), require => File[$base_installation::puppet_conf_path], diff --git a/modules/base_installation/templates/puppet/host_ldap.info.erb b/modules/base_installation/templates/puppet/host_ldap.info.erb index f742da7..525739b 100644 --- a/modules/base_installation/templates/puppet/host_ldap.info.erb +++ b/modules/base_installation/templates/puppet/host_ldap.info.erb @@ -7,6 +7,11 @@ objectclass: device objectclass: top objectclass: simpleSecurityObject objectclass: puppetClient +<%- unless @ips.empty? -%> +objectclass: ipHost +<% unless @ips["v4"].nil? -%>ipHostNumber: <%= @ips["v4"]["ipAddress"] %><%- end %> +<% unless @ips["v6"].nil? -%>ipHostNumber: <%= @ips["v6"]["ipAddress"] %>/<%= @ips["v6"]["mask"] %><%- end %> +<%- end -%> userpassword: {SSHA}<%= Base64.encode64(Digest::SHA1.digest(@ldap_password+@ssha_ldap_seed)+@ssha_ldap_seed).chomp! %> EOF #### Or modify an existing entry: @@ -15,4 +20,18 @@ dn: <%= @ldap_dn %> changetype: modify replace: userPassword userpassword: {SSHA}<%= Base64.encode64(Digest::SHA1.digest(@ldap_password+@ssha_ldap_seed)+@ssha_ldap_seed).chomp! %> +<%- unless @ips.empty? -%> +- +delete: ipHostNumber +<%- unless @ips["v4"].nil? -%> +- +add: ipHostNumber +ipHostNumber: <%= @ips["v4"]["ipAddress"] %> +<%- end -%> +<%- unless @ips["v6"].nil? -%> +- +add: ipHostNumber +ipHostNumber: <%= @ips["v6"]["ipAddress"] %>/<%= @ips["v6"]["mask"] %> +<%- end -%> +<%- end -%> EOF -- cgit v1.2.3