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 <<EOF
#!/bin/bash
expect eof
EOF
+### Role specific stage
+read -p "Press key when LDAP is configured" i
+
+cat > $ARCH_PUPPET_CONFIGURATION_SCRIPT <<EOF
+CODE_PATH="/etc/puppetlabs/code"
+puppet apply --test \$CODE_PATH/manifests/site.pp
+EOF
+
+cat > $ARCH_HOST_PUPPET_CONFIGURATION_SCRIPT <<EOF
+DEVICE_STR=\$(cat /proc/mounts | grep "/dev/sd.. /mnt/")
+DEVICE=\$(echo "\$DEVICE_STR" | cut -d' ' -f1)
+MOUNTPOINT=\$(echo "\$DEVICE_STR" | cut -d' ' -f2)
+
+cp /tmp/arch_puppet_configuration_script.sh "\$MOUNTPOINT/root/"
+
+/tmp/root.x86_64/bin/arch-chroot "\$MOUNTPOINT" /root/arch_puppet_configuration_script.sh
+EOF
+
+chmod a+x $ARCH_PUPPET_CONFIGURATION_SCRIPT $ARCH_HOST_PUPPET_CONFIGURATION_SCRIPT
+
+expect -f - <<EOF
+set timeout -1
+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
+expect "assword:"
+send "$password\n"
+expect eof
+spawn ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o CheckHostIP=no root@$vps_name /tmp/arch_host_puppet_configuration_script.sh
+expect "assword:"
+send "$password\r"
+expect eof
+EOF
+
+### Installation finished
read -p "Reboot to normal? [Y/n]" reboot
if [ "x$reboot" != "xn" ]; then
echo "Rebooting"
data_hash: yaml_data
hierarchy:
+# FIXME: those informations should be taken in LDAP, but bootstrap
+# problem for the hostname
+ - name: "Per-named-node data"
+ mapped_paths: [ldapvar.self.cn, hostname, "named_nodes/%{hostname}.yaml"]
+
- name: "Per-node data"
path: "nodes/%{facts.ec2_metadata.hostname}.yaml"
+### /FIXME
- name: "Per-role data"
mapped_paths: [ldapvar.self.vars.roles, role, "roles/%{role}.yaml"]
owner => 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'
+ }
}
}