]> git.immae.eu Git - perso/Immae/Projets/Puppet.git/blobdiff - modules/base_installation/templates/puppet/host_ldap.info.erb
Move scripts to separate chunks
[perso/Immae/Projets/Puppet.git] / modules / base_installation / templates / puppet / host_ldap.info.erb
index f742da78a23376d97f0ac75bc419d325027c6d91..9c79d3c8480bd6675c91d74bd495e3a08f64ac8e 100644 (file)
@@ -1,18 +1,40 @@
-#### Please add this node to LDAP:
+\e[0;35m#### Please add this node to LDAP:\e[0m
 ldapadd -D "cn=root,<%= @ldap_base %>" -W << 'EOF'
 dn: <%= @ldap_dn %>
 cn: <%= @ldap_cn %>
-cn: <%= @system_hostname %>
 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 -%>
+environment: <%= @environment %>
 userpassword: {SSHA}<%= Base64.encode64(Digest::SHA1.digest(@ldap_password+@ssha_ldap_seed)+@ssha_ldap_seed).chomp! %>
 EOF
-#### Or modify an existing entry:
+\e[0;35m#### Or modify an existing entry:\e[0m
 ldapmodify -D "cn=root,<%= @ldap_base %>" -W << 'EOF'
 dn: <%= @ldap_dn %>
 changetype: modify
 replace: userPassword
 userpassword: {SSHA}<%= Base64.encode64(Digest::SHA1.digest(@ldap_password+@ssha_ldap_seed)+@ssha_ldap_seed).chomp! %>
+-
+replace: environment
+environment: <%= @environment %>
+<%- 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