From 7dc85dc776e158e26202362f11a72d7491ef07c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Tue, 14 Aug 2018 22:49:29 +0200 Subject: Change host_ldap to concat --- modules/base_installation/manifests/puppet.pp | 32 +++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'modules/base_installation/manifests') diff --git a/modules/base_installation/manifests/puppet.pp b/modules/base_installation/manifests/puppet.pp index 05fe9a1..10b3773 100644 --- a/modules/base_installation/manifests/puppet.pp +++ b/modules/base_installation/manifests/puppet.pp @@ -109,10 +109,34 @@ class base_installation::puppet ( } $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_conf_path/host_ldap.info": + ensure => "present", + mode => "0600", + require => File[$base_installation::puppet_conf_path], + notify => Notify_refresh["notify-ldap-password"], + ensure_newline => true, + } + + concat::fragment { "host_ldap add top": + target => "$base_installation::puppet_conf_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_conf_path/host_ldap.info", + content => "EOF", + order => "00-99", + } + + concat::fragment { "host_ldap mod top": + target => "$base_installation::puppet_conf_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_conf_path/host_ldap.info", + content => "EOF", + order => "01-99", } notify_refresh { "notify-ldap-password": -- cgit v1.2.3 From a7b985dd3cc4af68875733eb135335a31504f472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Fri, 17 Aug 2018 12:51:33 +0200 Subject: Add cat_files report to notify of important changes --- modules/base_installation/manifests/init.pp | 33 ++++++++++++++------------- modules/base_installation/manifests/params.pp | 33 ++++++++++++++------------- modules/base_installation/manifests/puppet.pp | 28 ++++++++++++----------- 3 files changed, 49 insertions(+), 45 deletions(-) (limited to 'modules/base_installation/manifests') diff --git a/modules/base_installation/manifests/init.pp b/modules/base_installation/manifests/init.pp index d8abcaf..a1b5ca8 100644 --- a/modules/base_installation/manifests/init.pp +++ b/modules/base_installation/manifests/init.pp @@ -1,20 +1,21 @@ class base_installation ( - Optional[String] $grub_device = $base_installation::params::grub_device, - Optional[String] $ldap_base = $base_installation::params::ldap_base, - Optional[String] $ldap_cert_path = $base_installation::params::ldap_cert_path, - Optional[String] $ldap_cn = $base_installation::params::ldap_cn, - Optional[String] $ldap_dn = $base_installation::params::ldap_dn, - Optional[String] $ldap_server = $base_installation::params::ldap_server, - Optional[String] $ldap_uri = $base_installation::params::ldap_uri, - Optional[String] $puppet_code_path = $base_installation::params::puppet_code_path, - Optional[String] $puppet_conf_path = $base_installation::params::puppet_conf_path, - Optional[String] $puppet_pass_seed = $base_installation::params::puppet_pass_seed, - Optional[String] $puppet_ssl_path = $base_installation::params::puppet_ssl_path, - Optional[String] $real_hostname = $base_installation::params::real_hostname, - Optional[String] $system_hostname = $base_installation::params::system_hostname, - Optional[Array[String]] $system_locales = $base_installation::params::system_locales, - Optional[String] $system_timezone = $base_installation::params::system_timezone, - Optional[Array[Hash]] $system_users = $base_installation::params::system_users, + Optional[String] $grub_device = $base_installation::params::grub_device, + Optional[String] $ldap_base = $base_installation::params::ldap_base, + Optional[String] $ldap_cert_path = $base_installation::params::ldap_cert_path, + Optional[String] $ldap_cn = $base_installation::params::ldap_cn, + Optional[String] $ldap_dn = $base_installation::params::ldap_dn, + Optional[String] $ldap_server = $base_installation::params::ldap_server, + Optional[String] $ldap_uri = $base_installation::params::ldap_uri, + Optional[String] $puppet_code_path = $base_installation::params::puppet_code_path, + Optional[String] $puppet_conf_path = $base_installation::params::puppet_conf_path, + Optional[String] $puppet_notifies_path = $base_installation::params::puppet_notifies_path, + Optional[String] $puppet_pass_seed = $base_installation::params::puppet_pass_seed, + Optional[String] $puppet_ssl_path = $base_installation::params::puppet_ssl_path, + Optional[String] $real_hostname = $base_installation::params::real_hostname, + Optional[String] $system_hostname = $base_installation::params::system_hostname, + Optional[Array[String]] $system_locales = $base_installation::params::system_locales, + Optional[String] $system_timezone = $base_installation::params::system_timezone, + Optional[Array[Hash]] $system_users = $base_installation::params::system_users, ) inherits base_installation::params { contain ::base_installation::packages contain ::base_installation::locales diff --git a/modules/base_installation/manifests/params.pp b/modules/base_installation/manifests/params.pp index 5ade838..f336b65 100644 --- a/modules/base_installation/manifests/params.pp +++ b/modules/base_installation/manifests/params.pp @@ -1,20 +1,21 @@ class base_installation::params { - $puppet_code_path = "/etc/puppetlabs/code" - $puppet_conf_path = "/etc/puppetlabs/puppet" - $puppet_pass_seed = "/etc/puppetlabs/puppet/password_seed" - $puppet_ssl_path = "/etc/puppetlabs/ssl" - $grub_device = "/dev/sda" - $ldap_base = "dc=example,dc=com" - $ldap_cn = "node" - $ldap_dn = "cn=node,ou=hosts,dc=example,dc=com" - $ldap_cert_path = "/etc/ssl/certs/ca-certificates.crt" - $ldap_uri = "ldaps://ldap.example.com" - $ldap_server = "ldap.example.com" - $real_hostname = "example.com" - $system_hostname = "example.com" - $system_locales = ["en_US.UTF-8"] - $system_timezone = "UTC" - $system_users = [ + $puppet_code_path = "/etc/puppetlabs/code" + $puppet_conf_path = "/etc/puppetlabs/puppet" + $puppet_notifies_path = "/etc/puppetlabs/notifies" + $puppet_pass_seed = "/etc/puppetlabs/puppet/password_seed" + $puppet_ssl_path = "/etc/puppetlabs/ssl" + $grub_device = "/dev/sda" + $ldap_base = "dc=example,dc=com" + $ldap_cn = "node" + $ldap_dn = "cn=node,ou=hosts,dc=example,dc=com" + $ldap_cert_path = "/etc/ssl/certs/ca-certificates.crt" + $ldap_uri = "ldaps://ldap.example.com" + $ldap_server = "ldap.example.com" + $real_hostname = "example.com" + $system_hostname = "example.com" + $system_locales = ["en_US.UTF-8"] + $system_timezone = "UTC" + $system_users = [ { userid => 1000, username => "example", diff --git a/modules/base_installation/manifests/puppet.pp b/modules/base_installation/manifests/puppet.pp index 10b3773..603a961 100644 --- a/modules/base_installation/manifests/puppet.pp +++ b/modules/base_installation/manifests/puppet.pp @@ -103,45 +103,47 @@ class base_installation::puppet ( } } - if file("$base_installation::puppet_conf_path/host_ldap.info", "/dev/null") != "" and + 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 }) - concat { "$base_installation::puppet_conf_path/host_ldap.info": + concat { "$base_installation::puppet_notifies_path/host_ldap.info": ensure => "present", mode => "0600", - require => File[$base_installation::puppet_conf_path], - notify => Notify_refresh["notify-ldap-password"], + require => File[$base_installation::puppet_notifies_path], ensure_newline => true, } concat::fragment { "host_ldap add top": - target => "$base_installation::puppet_conf_path/host_ldap.info", + 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_conf_path/host_ldap.info", + target => "$base_installation::puppet_notifies_path/host_ldap.info", content => "EOF", order => "00-99", } concat::fragment { "host_ldap mod top": - target => "$base_installation::puppet_conf_path/host_ldap.info", + 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_conf_path/host_ldap.info", + target => "$base_installation::puppet_notifies_path/host_ldap.info", content => "EOF", order => "01-99", } - - notify_refresh { "notify-ldap-password": - message => template("base_installation/puppet/host_ldap.info.erb"), - refreshonly => true - } } } -- cgit v1.2.3