diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-08-14 22:49:29 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-08-17 12:50:25 +0200 |
commit | 7dc85dc776e158e26202362f11a72d7491ef07c8 (patch) | |
tree | a3e1c6d358efe68d8f00604ae10377735aca76cb | |
parent | 7f8c632757246813c0a9fdbf0c26ef036ff396be (diff) | |
download | Puppet-7dc85dc776e158e26202362f11a72d7491ef07c8.tar.gz Puppet-7dc85dc776e158e26202362f11a72d7491ef07c8.tar.zst Puppet-7dc85dc776e158e26202362f11a72d7491ef07c8.zip |
Change host_ldap to concat
-rw-r--r-- | modules/base_installation/manifests/puppet.pp | 32 | ||||
-rw-r--r-- | modules/base_installation/templates/puppet/host_ldap_add_top.info.erb (renamed from modules/base_installation/templates/puppet/host_ldap.info.erb) | 25 | ||||
-rw-r--r-- | modules/base_installation/templates/puppet/host_ldap_mod_top.info.erb | 23 |
3 files changed, 51 insertions, 29 deletions
diff --git a/modules/base_installation/manifests/puppet.pp b/modules/base_installation/manifests/puppet.pp index 05fe9a1..10b3773 100644 --- a/modules/base_installation/manifests/puppet.pp +++ b/modules/base_installation/manifests/puppet.pp | |||
@@ -109,10 +109,34 @@ class base_installation::puppet ( | |||
109 | } | 109 | } |
110 | 110 | ||
111 | $ips = lookup("ips", { 'default_value' => undef }) | 111 | $ips = lookup("ips", { 'default_value' => undef }) |
112 | file { "$base_installation::puppet_conf_path/host_ldap.info": | 112 | concat { "$base_installation::puppet_conf_path/host_ldap.info": |
113 | content => template("base_installation/puppet/host_ldap.info.erb"), | 113 | ensure => "present", |
114 | require => File[$base_installation::puppet_conf_path], | 114 | mode => "0600", |
115 | notify => Notify_refresh["notify-ldap-password"], | 115 | require => File[$base_installation::puppet_conf_path], |
116 | notify => Notify_refresh["notify-ldap-password"], | ||
117 | ensure_newline => true, | ||
118 | } | ||
119 | |||
120 | concat::fragment { "host_ldap add top": | ||
121 | target => "$base_installation::puppet_conf_path/host_ldap.info", | ||
122 | content => template("base_installation/puppet/host_ldap_add_top.info.erb"), | ||
123 | order => "00-01", | ||
124 | } | ||
125 | concat::fragment { "host_ldap add bottom": | ||
126 | target => "$base_installation::puppet_conf_path/host_ldap.info", | ||
127 | content => "EOF", | ||
128 | order => "00-99", | ||
129 | } | ||
130 | |||
131 | concat::fragment { "host_ldap mod top": | ||
132 | target => "$base_installation::puppet_conf_path/host_ldap.info", | ||
133 | content => template("base_installation/puppet/host_ldap_mod_top.info.erb"), | ||
134 | order => "01-01", | ||
135 | } | ||
136 | concat::fragment { "host_ldap mod bottom": | ||
137 | target => "$base_installation::puppet_conf_path/host_ldap.info", | ||
138 | content => "EOF", | ||
139 | order => "01-99", | ||
116 | } | 140 | } |
117 | 141 | ||
118 | notify_refresh { "notify-ldap-password": | 142 | notify_refresh { "notify-ldap-password": |
diff --git a/modules/base_installation/templates/puppet/host_ldap.info.erb b/modules/base_installation/templates/puppet/host_ldap_add_top.info.erb index 7afdf2d..3aafc19 100644 --- a/modules/base_installation/templates/puppet/host_ldap.info.erb +++ b/modules/base_installation/templates/puppet/host_ldap_add_top.info.erb | |||
@@ -14,28 +14,3 @@ objectclass: ipHost | |||
14 | environment: <%= @environment %> | 14 | environment: <%= @environment %> |
15 | puppetVar: real_hostname=<%= @real_hostname %> | 15 | puppetVar: real_hostname=<%= @real_hostname %> |
16 | userpassword: {SSHA}<%= Base64.encode64(Digest::SHA1.digest(@ldap_password+@ssha_ldap_seed)+@ssha_ldap_seed).chomp! %> | 16 | userpassword: {SSHA}<%= Base64.encode64(Digest::SHA1.digest(@ldap_password+@ssha_ldap_seed)+@ssha_ldap_seed).chomp! %> |
17 | EOF | ||
18 | [0;35m#### Or modify an existing entry:[0m | ||
19 | ldapmodify -D "cn=root,<%= @ldap_base %>" -W << 'EOF' | ||
20 | dn: <%= @ldap_dn %> | ||
21 | changetype: modify | ||
22 | replace: userPassword | ||
23 | userpassword: {SSHA}<%= Base64.encode64(Digest::SHA1.digest(@ldap_password+@ssha_ldap_seed)+@ssha_ldap_seed).chomp! %> | ||
24 | - | ||
25 | replace: environment | ||
26 | environment: <%= @environment %> | ||
27 | <%- unless @ips.empty? -%> | ||
28 | - | ||
29 | delete: ipHostNumber | ||
30 | <%- unless @ips["v4"].nil? -%> | ||
31 | - | ||
32 | add: ipHostNumber | ||
33 | ipHostNumber: <%= @ips["v4"]["ipAddress"] %> | ||
34 | <%- end -%> | ||
35 | <%- unless @ips["v6"].nil? -%> | ||
36 | - | ||
37 | add: ipHostNumber | ||
38 | ipHostNumber: <%= @ips["v6"]["ipAddress"] %>/<%= @ips["v6"]["mask"] %> | ||
39 | <%- end -%> | ||
40 | <%- end -%> | ||
41 | EOF | ||
diff --git a/modules/base_installation/templates/puppet/host_ldap_mod_top.info.erb b/modules/base_installation/templates/puppet/host_ldap_mod_top.info.erb new file mode 100644 index 0000000..d7a1294 --- /dev/null +++ b/modules/base_installation/templates/puppet/host_ldap_mod_top.info.erb | |||
@@ -0,0 +1,23 @@ | |||
1 | [0;35m#### Or modify an existing entry:[0m | ||
2 | ldapmodify -D "cn=root,<%= @ldap_base %>" -W << 'EOF' | ||
3 | dn: <%= @ldap_dn %> | ||
4 | changetype: modify | ||
5 | replace: userPassword | ||
6 | userpassword: {SSHA}<%= Base64.encode64(Digest::SHA1.digest(@ldap_password+@ssha_ldap_seed)+@ssha_ldap_seed).chomp! %> | ||
7 | - | ||
8 | replace: environment | ||
9 | environment: <%= @environment %> | ||
10 | <%- unless @ips.empty? -%> | ||
11 | - | ||
12 | delete: ipHostNumber | ||
13 | <%- unless @ips["v4"].nil? -%> | ||
14 | - | ||
15 | add: ipHostNumber | ||
16 | ipHostNumber: <%= @ips["v4"]["ipAddress"] %> | ||
17 | <%- end -%> | ||
18 | <%- unless @ips["v6"].nil? -%> | ||
19 | - | ||
20 | add: ipHostNumber | ||
21 | ipHostNumber: <%= @ips["v6"]["ipAddress"] %>/<%= @ips["v6"]["mask"] %> | ||
22 | <%- end -%> | ||
23 | <%- end -%> | ||