diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2017-08-30 22:16:39 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2017-08-31 22:59:53 +0200 |
commit | 548061112d2e2627317f9379d2f501fcf3f6ea54 (patch) | |
tree | 19fb949ad1fb965b4705897650809b4ffb6e9f29 /modules/base_installation/manifests/puppet.pp | |
parent | 1508e956adaa97b7a82c27537f4b124266dacdf0 (diff) | |
download | Puppet-548061112d2e2627317f9379d2f501fcf3f6ea54.tar.gz Puppet-548061112d2e2627317f9379d2f501fcf3f6ea54.tar.zst Puppet-548061112d2e2627317f9379d2f501fcf3f6ea54.zip |
Add LDAP support
Diffstat (limited to 'modules/base_installation/manifests/puppet.pp')
-rw-r--r-- | modules/base_installation/manifests/puppet.pp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/modules/base_installation/manifests/puppet.pp b/modules/base_installation/manifests/puppet.pp new file mode 100644 index 0000000..cd5697a --- /dev/null +++ b/modules/base_installation/manifests/puppet.pp | |||
@@ -0,0 +1,55 @@ | |||
1 | class base_installation::puppet ( | ||
2 | $password_seed = $base_installation::puppet_pass_seed | ||
3 | ) inherits base_installation { | ||
4 | File { | ||
5 | mode => "0600", | ||
6 | owner => "root", | ||
7 | group => "root", | ||
8 | } | ||
9 | |||
10 | exec { 'generate_password_seed': | ||
11 | command => "/usr/bin/openssl rand -base64 -out $password_seed 256", | ||
12 | creates => $password_seed, | ||
13 | environment => "RANDFILE=/dev/null", | ||
14 | } | ||
15 | |||
16 | unless empty(find_file($password_seed)) { | ||
17 | $ldap_password = generate_password(24, $password_seed, "ldap") | ||
18 | $ssha_ldap_seed = generate_password(5, $password_seed, "ldap_seed") | ||
19 | |||
20 | package { 'gem:ruby-ldap': | ||
21 | name => "ruby-ldap", | ||
22 | ensure => present, | ||
23 | provider => "gem", | ||
24 | install_options => "--no-user-install" | ||
25 | } | ||
26 | |||
27 | file { $password_seed: | ||
28 | mode => "0600", | ||
29 | } | ||
30 | |||
31 | file { $base_installation::puppet_conf_path: | ||
32 | ensure => directory, | ||
33 | require => [Package["puppet"], Package["gem:ruby-ldap"]], | ||
34 | recurse => true, | ||
35 | purge => true, | ||
36 | force => true, | ||
37 | } | ||
38 | |||
39 | file { "$base_installation::puppet_conf_path/puppet.conf": | ||
40 | content => template("base_installation/puppet/puppet.conf.erb"), | ||
41 | require => File[$base_installation::puppet_conf_path], | ||
42 | } | ||
43 | |||
44 | file { "$base_installation::puppet_conf_path/host_ldap.info": | ||
45 | content => template("base_installation/puppet/host_ldap.info.erb"), | ||
46 | require => File[$base_installation::puppet_conf_path], | ||
47 | notify => Notify_refresh["notify-ldap-password"], | ||
48 | } | ||
49 | |||
50 | notify_refresh { "notify-ldap-password": | ||
51 | message => template("base_installation/puppet/host_ldap.info.erb"), | ||
52 | refreshonly => true | ||
53 | } | ||
54 | } | ||
55 | } | ||