X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=modules%2Fbase_installation%2Fmanifests%2Fpuppet.pp;h=603a96115b97493f9f4d71af639c059ed6537c60;hb=a7b985dd3cc4af68875733eb135335a31504f472;hp=6f7732dfed2b83c63cdbd62cd13233c5af2d87ff;hpb=0a21fb6c2c52ca5cc2dfdfc41ca0a51c0d81296c;p=perso%2FImmae%2FProjets%2FPuppet.git diff --git a/modules/base_installation/manifests/puppet.pp b/modules/base_installation/manifests/puppet.pp index 6f7732d..603a961 100644 --- a/modules/base_installation/manifests/puppet.pp +++ b/modules/base_installation/manifests/puppet.pp @@ -27,6 +27,12 @@ class base_installation::puppet ( } ### + file { '/usr/local/sbin/i_puppet_lock': + mode => "0755", + ensure => present, + source => "puppet:///modules/base_installation/scripts/puppet_lock" + } + file { '/usr/local/sbin/i_puppet_reset_and_apply': mode => "0755", ensure => present, @@ -39,6 +45,12 @@ class base_installation::puppet ( source => "puppet:///modules/base_installation/scripts/report_print.rb" } + file { '/usr/local/sbin/puppet_apply': + mode => "0755", + ensure => present, + source => "puppet:///modules/base_installation/scripts/puppet_apply", + } + unless empty(find_file($password_seed)) { $ldap_password = generate_password(24, $password_seed, "ldap") $ssha_ldap_seed = generate_password(5, $password_seed, "ldap_seed") @@ -50,33 +62,88 @@ class base_installation::puppet ( install_options => "--no-user-install" } + package { 'gem:xmpp4r': + name => "xmpp4r", + 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"]], + require => [Package["puppet"], 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"), require => File[$base_installation::puppet_conf_path], } + unless empty($xmpp) { + file { "$base_installation::puppet_conf_path/xmpp.yaml": + content => template("base_installation/puppet/xmpp.yaml.erb"), + require => File[$base_installation::puppet_conf_path], + } + } + + 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["puppet"], 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", } } }