diff options
-rwxr-xr-x | bin/install_script.sh | 36 | ||||
-rw-r--r-- | environments/production/data/nodes/vps443660.novalocal.yaml | 1 | ||||
-rw-r--r-- | environments/production/data/types/vps-ovhssd-1.yaml | 1 | ||||
-rw-r--r-- | environments/production/hiera.yaml | 6 | ||||
-rw-r--r-- | modules/base_installation/manifests/cronie.pp | 8 | ||||
-rw-r--r-- | modules/base_installation/templates/puppet/host_ldap.info.erb | 1 | ||||
-rw-r--r-- | modules/base_installation/templates/puppet/puppet.conf.erb | 1 |
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` | |||
20 | ARCH_HOST_SCRIPT="$ARCH_DIR/arch_host_script.sh" | 20 | ARCH_HOST_SCRIPT="$ARCH_DIR/arch_host_script.sh" |
21 | ARCH_CHROOT_SCRIPT="$ARCH_DIR/arch_chroot_script.sh" | 21 | ARCH_CHROOT_SCRIPT="$ARCH_DIR/arch_chroot_script.sh" |
22 | ARCH_INSTALL_SCRIPT="$ARCH_DIR/arch_install_script.sh" | 22 | ARCH_INSTALL_SCRIPT="$ARCH_DIR/arch_install_script.sh" |
23 | ARCH_HOST_PUPPET_CONFIGURATION_SCRIPT="$ARCH_DIR/arch_host_puppet_configuration_script.sh" | ||
24 | ARCH_PUPPET_CONFIGURATION_SCRIPT="$ARCH_DIR/arch_puppet_configuration_script.sh" | ||
23 | 25 | ||
24 | trap "rm -rf $ARCH_DIR" EXIT | 26 | trap "rm -rf $ARCH_DIR" EXIT |
25 | 27 | ||
28 | #### Base installation stage | ||
26 | cat > $ARCH_HOST_SCRIPT <<EOF | 29 | cat > $ARCH_HOST_SCRIPT <<EOF |
27 | #!/bin/bash | 30 | #!/bin/bash |
28 | 31 | ||
@@ -117,6 +120,39 @@ send "$password\r" | |||
117 | expect eof | 120 | expect eof |
118 | EOF | 121 | EOF |
119 | 122 | ||
123 | ### Role specific stage | ||
124 | read -p "Press key when LDAP is configured" i | ||
125 | |||
126 | cat > $ARCH_PUPPET_CONFIGURATION_SCRIPT <<EOF | ||
127 | CODE_PATH="/etc/puppetlabs/code" | ||
128 | puppet apply --test \$CODE_PATH/manifests/site.pp | ||
129 | EOF | ||
130 | |||
131 | cat > $ARCH_HOST_PUPPET_CONFIGURATION_SCRIPT <<EOF | ||
132 | DEVICE_STR=\$(cat /proc/mounts | grep "/dev/sd.. /mnt/") | ||
133 | DEVICE=\$(echo "\$DEVICE_STR" | cut -d' ' -f1) | ||
134 | MOUNTPOINT=\$(echo "\$DEVICE_STR" | cut -d' ' -f2) | ||
135 | |||
136 | cp /tmp/arch_puppet_configuration_script.sh "\$MOUNTPOINT/root/" | ||
137 | |||
138 | /tmp/root.x86_64/bin/arch-chroot "\$MOUNTPOINT" /root/arch_puppet_configuration_script.sh | ||
139 | EOF | ||
140 | |||
141 | chmod a+x $ARCH_PUPPET_CONFIGURATION_SCRIPT $ARCH_HOST_PUPPET_CONFIGURATION_SCRIPT | ||
142 | |||
143 | expect -f - <<EOF | ||
144 | set timeout -1 | ||
145 | spawn scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o CheckHostIP=no $ARCH_PUPPET_CONFIGURATION_SCRIPT $ARCH_HOST_PUPPET_CONFIGURATION_SCRIPT root@$vps_name:/tmp | ||
146 | expect "assword:" | ||
147 | send "$password\n" | ||
148 | expect eof | ||
149 | spawn ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o CheckHostIP=no root@$vps_name /tmp/arch_host_puppet_configuration_script.sh | ||
150 | expect "assword:" | ||
151 | send "$password\r" | ||
152 | expect eof | ||
153 | EOF | ||
154 | |||
155 | ### Installation finished | ||
120 | read -p "Reboot to normal? [Y/n]" reboot | 156 | read -p "Reboot to normal? [Y/n]" reboot |
121 | if [ "x$reboot" != "xn" ]; then | 157 | if [ "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 | ||
6 | base_installation::grub_device: "/dev/sdb" | 6 | base_installation::grub_device: "/dev/sdb" |
7 | base_installation::ldap_cert_path: "/etc/ssl/certs/ca-certificates.crt" | 7 | base_installation::ldap_cert_path: "/etc/ssl/certs/ca-certificates.crt" |
8 | base_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 | ||
8 | hierarchy: | 8 | hierarchy: |
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 @@ | |||
2 | ldapadd -D "cn=root,<%= @ldap_base %>" -W << 'EOF' | 2 | ldapadd -D "cn=root,<%= @ldap_base %>" -W << 'EOF' |
3 | dn: <%= @ldap_dn %> | 3 | dn: <%= @ldap_dn %> |
4 | cn: <%= @ldap_cn %> | 4 | cn: <%= @ldap_cn %> |
5 | cn: <%= @system_hostname %> | ||
5 | objectclass: device | 6 | objectclass: device |
6 | objectclass: top | 7 | objectclass: top |
7 | objectclass: simpleSecurityObject | 8 | 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 @@ | |||
2 | ssldir = <%= @puppet_ssl_path %> | 2 | ssldir = <%= @puppet_ssl_path %> |
3 | 3 | ||
4 | node_terminus = ldap | 4 | node_terminus = ldap |
5 | certname = <%= @system_hostname %> | ||
5 | ldapserver = <%= @ldap_server %> | 6 | ldapserver = <%= @ldap_server %> |
6 | ldaptls = true | 7 | ldaptls = true |
7 | ldapbase = <%= @ldap_base %> | 8 | ldapbase = <%= @ldap_base %> |