aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/install_script.sh36
-rw-r--r--environments/production/data/nodes/vps443660.novalocal.yaml1
-rw-r--r--environments/production/data/types/vps-ovhssd-1.yaml1
-rw-r--r--environments/production/hiera.yaml6
-rw-r--r--modules/base_installation/manifests/cronie.pp8
-rw-r--r--modules/base_installation/templates/puppet/host_ldap.info.erb1
-rw-r--r--modules/base_installation/templates/puppet/puppet.conf.erb1
7 files changed, 52 insertions, 2 deletions
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`
20ARCH_HOST_SCRIPT="$ARCH_DIR/arch_host_script.sh" 20ARCH_HOST_SCRIPT="$ARCH_DIR/arch_host_script.sh"
21ARCH_CHROOT_SCRIPT="$ARCH_DIR/arch_chroot_script.sh" 21ARCH_CHROOT_SCRIPT="$ARCH_DIR/arch_chroot_script.sh"
22ARCH_INSTALL_SCRIPT="$ARCH_DIR/arch_install_script.sh" 22ARCH_INSTALL_SCRIPT="$ARCH_DIR/arch_install_script.sh"
23ARCH_HOST_PUPPET_CONFIGURATION_SCRIPT="$ARCH_DIR/arch_host_puppet_configuration_script.sh"
24ARCH_PUPPET_CONFIGURATION_SCRIPT="$ARCH_DIR/arch_puppet_configuration_script.sh"
23 25
24trap "rm -rf $ARCH_DIR" EXIT 26trap "rm -rf $ARCH_DIR" EXIT
25 27
28#### Base installation stage
26cat > $ARCH_HOST_SCRIPT <<EOF 29cat > $ARCH_HOST_SCRIPT <<EOF
27#!/bin/bash 30#!/bin/bash
28 31
@@ -117,6 +120,39 @@ send "$password\r"
117expect eof 120expect eof
118EOF 121EOF
119 122
123### Role specific stage
124read -p "Press key when LDAP is configured" i
125
126cat > $ARCH_PUPPET_CONFIGURATION_SCRIPT <<EOF
127CODE_PATH="/etc/puppetlabs/code"
128puppet apply --test \$CODE_PATH/manifests/site.pp
129EOF
130
131cat > $ARCH_HOST_PUPPET_CONFIGURATION_SCRIPT <<EOF
132DEVICE_STR=\$(cat /proc/mounts | grep "/dev/sd.. /mnt/")
133DEVICE=\$(echo "\$DEVICE_STR" | cut -d' ' -f1)
134MOUNTPOINT=\$(echo "\$DEVICE_STR" | cut -d' ' -f2)
135
136cp /tmp/arch_puppet_configuration_script.sh "\$MOUNTPOINT/root/"
137
138/tmp/root.x86_64/bin/arch-chroot "\$MOUNTPOINT" /root/arch_puppet_configuration_script.sh
139EOF
140
141chmod a+x $ARCH_PUPPET_CONFIGURATION_SCRIPT $ARCH_HOST_PUPPET_CONFIGURATION_SCRIPT
142
143expect -f - <<EOF
144set timeout -1
145spawn scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o CheckHostIP=no $ARCH_PUPPET_CONFIGURATION_SCRIPT $ARCH_HOST_PUPPET_CONFIGURATION_SCRIPT root@$vps_name:/tmp
146expect "assword:"
147send "$password\n"
148expect eof
149spawn ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o CheckHostIP=no root@$vps_name /tmp/arch_host_puppet_configuration_script.sh
150expect "assword:"
151send "$password\r"
152expect eof
153EOF
154
155### Installation finished
120read -p "Reboot to normal? [Y/n]" reboot 156read -p "Reboot to normal? [Y/n]" reboot
121if [ "x$reboot" != "xn" ]; then 157if [ "x$reboot" != "xn" ]; then
122 echo "Rebooting" 158 echo "Rebooting"
diff --git a/environments/production/data/nodes/vps443660.novalocal.yaml b/environments/production/data/nodes/vps443660.novalocal.yaml
new file mode 100644
index 0000000..e6d3c1c
--- /dev/null
+++ b/environments/production/data/nodes/vps443660.novalocal.yaml
@@ -0,0 +1 @@
base_installation::system_hostname: foo.immae.eu
diff --git a/environments/production/data/types/vps-ovhssd-1.yaml b/environments/production/data/types/vps-ovhssd-1.yaml
index 217dd82..968bf6b 100644
--- a/environments/production/data/types/vps-ovhssd-1.yaml
+++ b/environments/production/data/types/vps-ovhssd-1.yaml
@@ -5,4 +5,3 @@ classes:
5 5
6base_installation::grub_device: "/dev/sdb" 6base_installation::grub_device: "/dev/sdb"
7base_installation::ldap_cert_path: "/etc/ssl/certs/ca-certificates.crt" 7base_installation::ldap_cert_path: "/etc/ssl/certs/ca-certificates.crt"
8base_installation::system_hostname: "new.immae.eu"
diff --git a/environments/production/hiera.yaml b/environments/production/hiera.yaml
index f5e5bc2..44c7ecd 100644
--- a/environments/production/hiera.yaml
+++ b/environments/production/hiera.yaml
@@ -6,8 +6,14 @@ defaults:
6 data_hash: yaml_data 6 data_hash: yaml_data
7 7
8hierarchy: 8hierarchy:
9# FIXME: those informations should be taken in LDAP, but bootstrap
10# problem for the hostname
11 - name: "Per-named-node data"
12 mapped_paths: [ldapvar.self.cn, hostname, "named_nodes/%{hostname}.yaml"]
13
9 - name: "Per-node data" 14 - name: "Per-node data"
10 path: "nodes/%{facts.ec2_metadata.hostname}.yaml" 15 path: "nodes/%{facts.ec2_metadata.hostname}.yaml"
16### /FIXME
11 17
12 - name: "Per-role data" 18 - name: "Per-role data"
13 mapped_paths: [ldapvar.self.vars.roles, role, "roles/%{role}.yaml"] 19 mapped_paths: [ldapvar.self.vars.roles, role, "roles/%{role}.yaml"]
diff --git a/modules/base_installation/manifests/cronie.pp b/modules/base_installation/manifests/cronie.pp
index bcdd9a7..918bce3 100644
--- a/modules/base_installation/manifests/cronie.pp
+++ b/modules/base_installation/manifests/cronie.pp
@@ -10,12 +10,18 @@ class base_installation::cronie inherits base_installation {
10 owner => root, 10 owner => root,
11 group => root, 11 group => root,
12 } 12 }
13 cron { 'puppet-apply': 13 cron { 'puppet-pull-apply':
14 ensure => present, 14 ensure => present,
15 command => "cd $base_installation::puppet_code_path ; /usr/bin/git pull", 15 command => "cd $base_installation::puppet_code_path ; /usr/bin/git pull",
16 user => root, 16 user => root,
17 minute => '*/30', 17 minute => '*/30',
18 require => File['post-hook'], 18 require => File['post-hook'],
19 } 19 }
20 cron { 'puppet-apply':
21 ensure => present,
22 command => "cd $base_installation::puppet_code_path ; puppet apply --test $base_installation::puppet_code_path/manifests/site.pp",
23 user => root,
24 minute => '*/20'
25 }
20 } 26 }
21} 27}
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 @@
2ldapadd -D "cn=root,<%= @ldap_base %>" -W << 'EOF' 2ldapadd -D "cn=root,<%= @ldap_base %>" -W << 'EOF'
3dn: <%= @ldap_dn %> 3dn: <%= @ldap_dn %>
4cn: <%= @ldap_cn %> 4cn: <%= @ldap_cn %>
5cn: <%= @system_hostname %>
5objectclass: device 6objectclass: device
6objectclass: top 7objectclass: top
7objectclass: simpleSecurityObject 8objectclass: 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 @@
2ssldir = <%= @puppet_ssl_path %> 2ssldir = <%= @puppet_ssl_path %>
3 3
4node_terminus = ldap 4node_terminus = ldap
5certname = <%= @system_hostname %>
5ldapserver = <%= @ldap_server %> 6ldapserver = <%= @ldap_server %>
6ldaptls = true 7ldaptls = true
7ldapbase = <%= @ldap_base %> 8ldapbase = <%= @ldap_base %>