diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2017-09-18 00:16:05 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2017-09-18 00:22:19 +0200 |
commit | 51ab750fa5b84edd34d50d898f12aa1d2032950c (patch) | |
tree | 3eb03764229a0a7925d409df15f08ad6a71d1bbb /modules | |
parent | eac05dd434b4bbb068d41620d574d86165ad6e20 (diff) | |
download | Puppet-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.pp | 1 | ||||
-rw-r--r-- | modules/base_installation/templates/puppet/host_ldap.info.erb | 19 |
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 | |||
7 | objectclass: top | 7 | objectclass: top |
8 | objectclass: simpleSecurityObject | 8 | objectclass: simpleSecurityObject |
9 | objectclass: puppetClient | 9 | objectclass: puppetClient |
10 | <%- unless @ips.empty? -%> | ||
11 | objectclass: 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 -%> | ||
10 | userpassword: {SSHA}<%= Base64.encode64(Digest::SHA1.digest(@ldap_password+@ssha_ldap_seed)+@ssha_ldap_seed).chomp! %> | 15 | userpassword: {SSHA}<%= Base64.encode64(Digest::SHA1.digest(@ldap_password+@ssha_ldap_seed)+@ssha_ldap_seed).chomp! %> |
11 | EOF | 16 | EOF |
12 | #### Or modify an existing entry: | 17 | #### Or modify an existing entry: |
@@ -15,4 +20,18 @@ dn: <%= @ldap_dn %> | |||
15 | changetype: modify | 20 | changetype: modify |
16 | replace: userPassword | 21 | replace: userPassword |
17 | userpassword: {SSHA}<%= Base64.encode64(Digest::SHA1.digest(@ldap_password+@ssha_ldap_seed)+@ssha_ldap_seed).chomp! %> | 22 | userpassword: {SSHA}<%= Base64.encode64(Digest::SHA1.digest(@ldap_password+@ssha_ldap_seed)+@ssha_ldap_seed).chomp! %> |
23 | <%- unless @ips.empty? -%> | ||
24 | - | ||
25 | delete: ipHostNumber | ||
26 | <%- unless @ips["v4"].nil? -%> | ||
27 | - | ||
28 | add: ipHostNumber | ||
29 | ipHostNumber: <%= @ips["v4"]["ipAddress"] %> | ||
30 | <%- end -%> | ||
31 | <%- unless @ips["v6"].nil? -%> | ||
32 | - | ||
33 | add: ipHostNumber | ||
34 | ipHostNumber: <%= @ips["v6"]["ipAddress"] %>/<%= @ips["v6"]["mask"] %> | ||
35 | <%- end -%> | ||
36 | <%- end -%> | ||
18 | EOF | 37 | EOF |