aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2017-09-18 00:16:05 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2017-09-18 00:22:19 +0200
commit51ab750fa5b84edd34d50d898f12aa1d2032950c (patch)
tree3eb03764229a0a7925d409df15f08ad6a71d1bbb /modules
parenteac05dd434b4bbb068d41620d574d86165ad6e20 (diff)
downloadPuppet-51ab750fa5b84edd34d50d898f12aa1d2032950c.tar.gz
Puppet-51ab750fa5b84edd34d50d898f12aa1d2032950c.tar.zst
Puppet-51ab750fa5b84edd34d50d898f12aa1d2032950c.zip
Add ips to LDAP
Diffstat (limited to 'modules')
-rw-r--r--modules/base_installation/manifests/puppet.pp1
-rw-r--r--modules/base_installation/templates/puppet/host_ldap.info.erb19
2 files changed, 20 insertions, 0 deletions
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 (
55 require => File[$base_installation::puppet_conf_path], 55 require => File[$base_installation::puppet_conf_path],
56 } 56 }
57 57
58 $ips = lookup("ips") |$key| { {} }
58 file { "$base_installation::puppet_conf_path/host_ldap.info": 59 file { "$base_installation::puppet_conf_path/host_ldap.info":
59 content => template("base_installation/puppet/host_ldap.info.erb"), 60 content => template("base_installation/puppet/host_ldap.info.erb"),
60 require => File[$base_installation::puppet_conf_path], 61 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
7objectclass: top 7objectclass: top
8objectclass: simpleSecurityObject 8objectclass: simpleSecurityObject
9objectclass: puppetClient 9objectclass: puppetClient
10<%- unless @ips.empty? -%>
11objectclass: ipHost
12<% unless @ips["v4"].nil? -%>ipHostNumber: <%= @ips["v4"]["ipAddress"] %><%- end %>
13<% unless @ips["v6"].nil? -%>ipHostNumber: <%= @ips["v6"]["ipAddress"] %>/<%= @ips["v6"]["mask"] %><%- end %>
14<%- end -%>
10userpassword: {SSHA}<%= Base64.encode64(Digest::SHA1.digest(@ldap_password+@ssha_ldap_seed)+@ssha_ldap_seed).chomp! %> 15userpassword: {SSHA}<%= Base64.encode64(Digest::SHA1.digest(@ldap_password+@ssha_ldap_seed)+@ssha_ldap_seed).chomp! %>
11EOF 16EOF
12#### Or modify an existing entry: 17#### Or modify an existing entry:
@@ -15,4 +20,18 @@ dn: <%= @ldap_dn %>
15changetype: modify 20changetype: modify
16replace: userPassword 21replace: userPassword
17userpassword: {SSHA}<%= Base64.encode64(Digest::SHA1.digest(@ldap_password+@ssha_ldap_seed)+@ssha_ldap_seed).chomp! %> 22userpassword: {SSHA}<%= Base64.encode64(Digest::SHA1.digest(@ldap_password+@ssha_ldap_seed)+@ssha_ldap_seed).chomp! %>
23<%- unless @ips.empty? -%>
24-
25delete: ipHostNumber
26<%- unless @ips["v4"].nil? -%>
27-
28add: ipHostNumber
29ipHostNumber: <%= @ips["v4"]["ipAddress"] %>
30<%- end -%>
31<%- unless @ips["v6"].nil? -%>
32-
33add: ipHostNumber
34ipHostNumber: <%= @ips["v6"]["ipAddress"] %>/<%= @ips["v6"]["mask"] %>
35<%- end -%>
36<%- end -%>
18EOF 37EOF