From 548061112d2e2627317f9379d2f501fcf3f6ea54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Wed, 30 Aug 2017 22:16:39 +0200 Subject: Add LDAP support --- modules/base_installation/manifests/puppet.pp | 55 +++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 modules/base_installation/manifests/puppet.pp (limited to 'modules/base_installation/manifests/puppet.pp') 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 @@ +class base_installation::puppet ( + $password_seed = $base_installation::puppet_pass_seed +) inherits base_installation { + File { + mode => "0600", + owner => "root", + group => "root", + } + + exec { 'generate_password_seed': + command => "/usr/bin/openssl rand -base64 -out $password_seed 256", + creates => $password_seed, + environment => "RANDFILE=/dev/null", + } + + unless empty(find_file($password_seed)) { + $ldap_password = generate_password(24, $password_seed, "ldap") + $ssha_ldap_seed = generate_password(5, $password_seed, "ldap_seed") + + package { 'gem:ruby-ldap': + name => "ruby-ldap", + ensure => present, + provider => "gem", + install_options => "--no-user-install" + } + + file { $password_seed: + mode => "0600", + } + + file { $base_installation::puppet_conf_path: + ensure => directory, + require => [Package["puppet"], Package["gem:ruby-ldap"]], + recurse => true, + purge => true, + force => true, + } + + file { "$base_installation::puppet_conf_path/puppet.conf": + content => template("base_installation/puppet/puppet.conf.erb"), + require => File[$base_installation::puppet_conf_path], + } + + 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], + notify => Notify_refresh["notify-ldap-password"], + } + + notify_refresh { "notify-ldap-password": + message => template("base_installation/puppet/host_ldap.info.erb"), + refreshonly => true + } + } +} -- cgit v1.2.3