]> git.immae.eu Git - perso/Immae/Projets/Puppet.git/commitdiff
Add ips to LDAP
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Sun, 17 Sep 2017 22:16:05 +0000 (00:16 +0200)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Sun, 17 Sep 2017 22:22:19 +0000 (00:22 +0200)
modules/base_installation/manifests/puppet.pp
modules/base_installation/templates/puppet/host_ldap.info.erb

index 6ad4b22691c42e5f950b27757f07df06933cb499..a8dc641949e83edb3c23a2164037e5c88d299596 100644 (file)
@@ -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],
index f742da78a23376d97f0ac75bc419d325027c6d91..525739b45bc2c58fae0a164d3f4297442cbb924b 100644 (file)
@@ -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