X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=modules%2Fbase_installation%2Fmanifests%2Fpuppet.pp;h=a8062170d93215046ad2a67a18348ba89635070b;hb=98776befc7635f5a92670f66e991d39e8beb599e;hp=fa2db6920dcbad5089f6726b22a418c5e76d5b44;hpb=e3cc4c31bd41b5a2d4b3d5f4e1ecc27b541540c4;p=perso%2FImmae%2FProjets%2FPuppet.git diff --git a/modules/base_installation/manifests/puppet.pp b/modules/base_installation/manifests/puppet.pp index fa2db69..a806217 100644 --- a/modules/base_installation/manifests/puppet.pp +++ b/modules/base_installation/manifests/puppet.pp @@ -75,13 +75,14 @@ class base_installation::puppet ( file { $base_installation::puppet_conf_path: ensure => directory, - require => [Package["puppet"], Package["gem:xmpp4r"], Package["gem:ruby-ldap"]], + require => [Package["puppet5"], Package["gem:xmpp4r"], Package["gem:ruby-ldap"]], recurse => true, purge => true, force => true, } $xmpp = lookup("base_installation::notify_xmpp", { "default_value" => {} }) + $slack = lookup("base_installation::notify_slack", { "default_value" => {} }) file { "$base_installation::puppet_conf_path/puppet.conf": content => template("base_installation/puppet/puppet.conf.erb"), @@ -95,16 +96,54 @@ class base_installation::puppet ( } } + unless empty($slack) { + file { "$base_installation::puppet_conf_path/slack.yaml": + content => template("base_installation/puppet/slack.yaml.erb"), + require => File[$base_installation::puppet_conf_path], + } + } + + if file("$base_installation::puppet_notifies_path/host_ldap.info", "/dev/null") != "" and + empty($facts["ldapvar"]) { + fail("LDAP was activated but facts are not available") + } + + file { $base_installation::puppet_notifies_path: + ensure => directory, + require => [Package["puppet5"], Package["gem:xmpp4r"], Package["gem:ruby-ldap"]], + recurse => true, + purge => true, + force => true, + } + $ips = lookup("ips", { 'default_value' => undef }) - 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"], + concat { "$base_installation::puppet_notifies_path/host_ldap.info": + ensure => "present", + mode => "0600", + require => File[$base_installation::puppet_notifies_path], + ensure_newline => true, } - notify_refresh { "notify-ldap-password": - message => template("base_installation/puppet/host_ldap.info.erb"), - refreshonly => true + concat::fragment { "host_ldap add top": + target => "$base_installation::puppet_notifies_path/host_ldap.info", + content => template("base_installation/puppet/host_ldap_add_top.info.erb"), + order => "00-01", + } + concat::fragment { "host_ldap add bottom": + target => "$base_installation::puppet_notifies_path/host_ldap.info", + content => "EOF", + order => "00-99", + } + + concat::fragment { "host_ldap mod top": + target => "$base_installation::puppet_notifies_path/host_ldap.info", + content => template("base_installation/puppet/host_ldap_mod_top.info.erb"), + order => "01-01", + } + concat::fragment { "host_ldap mod bottom": + target => "$base_installation::puppet_notifies_path/host_ldap.info", + content => "EOF", + order => "01-99", } } }