From 85abd2fdbad83430df4824843764719064afb9b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Sat, 3 Mar 2018 22:24:19 +0100 Subject: Fetch node informations from LDAP environment, hostname --- modules/base_installation/manifests/init.pp | 1 + modules/base_installation/manifests/params.pp | 1 + .../base_installation/manifests/system_config.pp | 34 ++++++++++++---------- 3 files changed, 21 insertions(+), 15 deletions(-) (limited to 'modules/base_installation/manifests') diff --git a/modules/base_installation/manifests/init.pp b/modules/base_installation/manifests/init.pp index f9fdcd4..998f8ff 100644 --- a/modules/base_installation/manifests/init.pp +++ b/modules/base_installation/manifests/init.pp @@ -10,6 +10,7 @@ class base_installation ( 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, diff --git a/modules/base_installation/manifests/params.pp b/modules/base_installation/manifests/params.pp index c03eb1e..5ade838 100644 --- a/modules/base_installation/manifests/params.pp +++ b/modules/base_installation/manifests/params.pp @@ -10,6 +10,7 @@ class base_installation::params { $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" diff --git a/modules/base_installation/manifests/system_config.pp b/modules/base_installation/manifests/system_config.pp index 25bfe0f..ccc5dcc 100644 --- a/modules/base_installation/manifests/system_config.pp +++ b/modules/base_installation/manifests/system_config.pp @@ -6,23 +6,27 @@ class base_installation::system_config inherits base_installation { } } - unless empty($base_installation::system_hostname) { - file { '/etc/hostname': - content => "$base_installation::system_hostname\n", - } + if empty($base_installation::system_hostname) { + $hostname = $base_installation::real_hostname + } else { + $hostname = $base_installation::system_hostname + } - exec { "set_hostname": - command => "/usr/bin/hostnamectl set-hostname $base_installation::system_hostname", - refreshonly => true, - subscribe => File["/etc/hostname"], - returns => [0, 1], - } + file { '/etc/hostname': + content => "$base_installation::system_hostname\n", + } - # TODO: find a way to ensure that /etc/hostname doesn't change - # exec { "set_hostname_firstboot": - # command => "/usr/bin/systemd-firstboot --hostname=$base_installation::system_hostname", - # creates => "/etc/hostname", - # } + exec { "set_hostname": + command => "/usr/bin/hostnamectl set-hostname $base_installation::system_hostname", + refreshonly => true, + subscribe => File["/etc/hostname"], + returns => [0, 1], } + # TODO: find a way to ensure that /etc/hostname doesn't change + # exec { "set_hostname_firstboot": + # command => "/usr/bin/systemd-firstboot --hostname=$base_installation::system_hostname", + # creates => "/etc/hostname", + # } + } -- cgit v1.2.3 From 2499f7e73946cd5147a1158b48ebe4b06e4e530d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Sun, 4 Mar 2018 12:28:24 +0100 Subject: Add helpers and remove logs from cronie --- modules/base_installation/manifests/cronie.pp | 4 ++-- modules/base_installation/manifests/puppet.pp | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'modules/base_installation/manifests') diff --git a/modules/base_installation/manifests/cronie.pp b/modules/base_installation/manifests/cronie.pp index 4df0e37..72f2d8f 100644 --- a/modules/base_installation/manifests/cronie.pp +++ b/modules/base_installation/manifests/cronie.pp @@ -19,13 +19,13 @@ class base_installation::cronie inherits base_installation { } cron { 'puppet-apply': ensure => present, - command => "cd $base_installation::puppet_code_path ; puppet apply --test $base_installation::puppet_code_path/manifests/site.pp", + command => "cd $base_installation::puppet_code_path ; puppet apply $base_installation::puppet_code_path/manifests/site.pp", user => root, minute => '*/20' } cron { 'puppet-apply-reboot': ensure => present, - command => "cd $base_installation::puppet_code_path ; puppet apply --test $base_installation::puppet_code_path/manifests/site.pp", + command => "cd $base_installation::puppet_code_path ; puppet apply $base_installation::puppet_code_path/manifests/site.pp", user => root, special => "reboot" } diff --git a/modules/base_installation/manifests/puppet.pp b/modules/base_installation/manifests/puppet.pp index a8dc641..b3ce492 100644 --- a/modules/base_installation/manifests/puppet.pp +++ b/modules/base_installation/manifests/puppet.pp @@ -27,6 +27,18 @@ class base_installation::puppet ( } ### + file { '/usr/local/sbin/i_puppet_reset_and_apply': + mode => "0755", + ensure => present, + source => "puppet:///modules/base_installation/scripts/puppet_reset_and_apply" + } + + file { '/usr/local/sbin/i_puppet_report_print': + mode => "0755", + ensure => present, + source => "puppet:///modules/base_installation/scripts/report_print.rb" + } + unless empty(find_file($password_seed)) { $ldap_password = generate_password(24, $password_seed, "ldap") $ssha_ldap_seed = generate_password(5, $password_seed, "ldap_seed") -- cgit v1.2.3