From 503e4cf5c54e3fe4b802038e8917341c4ce803e5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Isma=C3=ABl=20Bouya?= Date: Sun, 10 Sep 2017 12:45:41 +0200 Subject: [PATCH] Make use of LDAP variables to configure node --- bin/install_script.sh | 36 +++++++++++++++++++ .../data/nodes/vps443660.novalocal.yaml | 1 + .../production/data/types/vps-ovhssd-1.yaml | 1 - environments/production/hiera.yaml | 6 ++++ modules/base_installation/manifests/cronie.pp | 8 ++++- .../templates/puppet/host_ldap.info.erb | 1 + .../templates/puppet/puppet.conf.erb | 1 + 7 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 environments/production/data/nodes/vps443660.novalocal.yaml diff --git a/bin/install_script.sh b/bin/install_script.sh index f250285..f46ab29 100755 --- a/bin/install_script.sh +++ b/bin/install_script.sh @@ -20,9 +20,12 @@ ARCH_DIR=`mktemp -d` ARCH_HOST_SCRIPT="$ARCH_DIR/arch_host_script.sh" ARCH_CHROOT_SCRIPT="$ARCH_DIR/arch_chroot_script.sh" ARCH_INSTALL_SCRIPT="$ARCH_DIR/arch_install_script.sh" +ARCH_HOST_PUPPET_CONFIGURATION_SCRIPT="$ARCH_DIR/arch_host_puppet_configuration_script.sh" +ARCH_PUPPET_CONFIGURATION_SCRIPT="$ARCH_DIR/arch_puppet_configuration_script.sh" trap "rm -rf $ARCH_DIR" EXIT +#### Base installation stage cat > $ARCH_HOST_SCRIPT < $ARCH_PUPPET_CONFIGURATION_SCRIPT < $ARCH_HOST_PUPPET_CONFIGURATION_SCRIPT < root, group => root, } - cron { 'puppet-apply': + cron { 'puppet-pull-apply': ensure => present, command => "cd $base_installation::puppet_code_path ; /usr/bin/git pull", user => root, minute => '*/30', require => File['post-hook'], } + cron { 'puppet-apply': + ensure => present, + command => "cd $base_installation::puppet_code_path ; puppet apply --test $base_installation::puppet_code_path/manifests/site.pp", + user => root, + minute => '*/20' + } } } diff --git a/modules/base_installation/templates/puppet/host_ldap.info.erb b/modules/base_installation/templates/puppet/host_ldap.info.erb index a350c37..f742da7 100644 --- a/modules/base_installation/templates/puppet/host_ldap.info.erb +++ b/modules/base_installation/templates/puppet/host_ldap.info.erb @@ -2,6 +2,7 @@ ldapadd -D "cn=root,<%= @ldap_base %>" -W << 'EOF' dn: <%= @ldap_dn %> cn: <%= @ldap_cn %> +cn: <%= @system_hostname %> objectclass: device objectclass: top objectclass: simpleSecurityObject diff --git a/modules/base_installation/templates/puppet/puppet.conf.erb b/modules/base_installation/templates/puppet/puppet.conf.erb index 99d9fc3..3748039 100644 --- a/modules/base_installation/templates/puppet/puppet.conf.erb +++ b/modules/base_installation/templates/puppet/puppet.conf.erb @@ -2,6 +2,7 @@ ssldir = <%= @puppet_ssl_path %> node_terminus = ldap +certname = <%= @system_hostname %> ldapserver = <%= @ldap_server %> ldaptls = true ldapbase = <%= @ldap_base %> -- 2.41.0