7 --instance-id id Id of the instance
8 --reinstall-first Start with reinstalling the vps
9 --host-user user Use another user (default: arch)
10 --no-reboot Don't reboot
11 --no-reboot-start Don't reboot to rescue at the beginning
12 --no-reboot-end Don't reboot to normal at the end
13 --git-branch Use another puppet branch (default: master)
14 --environment Environment to use for the installl (default: production)
22 environment
=production
63 DIRECTORY
=$(cd `dirname $0` && pwd)
64 PYTHON_DIRECTORY
="$DIRECTORY/../python"
65 SCRIPTS
="$DIRECTORY/../scripts"
67 if [ -z "$instance_id" ]; then
68 read -p "Id de l'instance : " instance_id
71 if [ -n "$reinstall_first" ]; then
72 echo "Réinstallation du système"
73 python
$PYTHON_DIRECTORY/reinstall_cloud_instance.py
--use-current "$instance_id"
75 read -p "Appuyer sur une touche quand le serveur est prêt" ready
78 if [ -z "$no_reboot" -a -z "$no_reboot_start" ]; then
79 echo "Patienter le temps du reboot"
80 python
$PYTHON_DIRECTORY/reboot_cloud_instance.py
--rescue "$instance_id"
82 read -p "Appuyer sur une touche quand l'instance a redémarré" ready
86 ARCH_HOST_SCRIPT
="$SCRIPTS/ovh_cloud_instance/arch_host_script.sh"
87 ARCH_INSTALL_SCRIPT
="$SCRIPTS/arch_install_script.sh"
88 ARCH_HOST_PUPPET_CONFIGURATION_SCRIPT
="$SCRIPTS/ovh_cloud_instance/arch_host_puppet_configuration_script.sh"
89 ARCH_PUPPET_CONFIGURATION_SCRIPT
="$SCRIPTS/arch_puppet_configuration_script.sh"
90 ARCH_PUPPET_INITIAL_CONFIGURATION
="$ARCH_DIR/puppet_variables.json"
92 trap "rm -rf $ARCH_DIR" EXIT
94 #### Base installation stage
95 python
$PYTHON_DIRECTORY/get_initial_configuration_cloud_instance.py
$instance_id > $ARCH_PUPPET_INITIAL_CONFIGURATION
96 host_address
=$(python $PYTHON_DIRECTORY/get_initial_configuration_cloud_instance.py $instance_id | jq -r '.ips.v4.ipAddress')
98 dest
="$host_user@$host_address"
99 files
="$ARCH_HOST_SCRIPT $ARCH_PUPPET_INITIAL_CONFIGURATION $ARCH_INSTALL_SCRIPT"
101 $SCRIPTS/send_and_run.tcl
"$dest" "" "$git_branch" "$environment" $files
103 ### Role specific stage
104 read -p "Press key when LDAP is configured" i
106 files
="$ARCH_HOST_PUPPET_CONFIGURATION_SCRIPT $ARCH_PUPPET_CONFIGURATION_SCRIPT"
108 $SCRIPTS/send_and_run.tcl
"$dest" "" "$git_branch" "$environment" $files
110 ### Installation finished
111 if [ -z "$no_reboot" -a -z "$no_reboot_end" ]; then
113 python
$PYTHON_DIRECTORY/reboot_cloud_instance.py
--local "$instance_id"