X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=modules%2Fbase_installation%2Fmanifests%2Fpuppet.pp;fp=modules%2Fbase_installation%2Fmanifests%2Fpuppet.pp;h=cd5697ac5bf783e069705e1dbd2bc284cfb01291;hb=548061112d2e2627317f9379d2f501fcf3f6ea54;hp=0000000000000000000000000000000000000000;hpb=1508e956adaa97b7a82c27537f4b124266dacdf0;p=perso%2FImmae%2FProjets%2FPuppet.git 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 + } + } +}