5 $(basename $0) [options]
8 One of the following options is necessary:
9 --instance-id id Id of the cloud instance
10 --vps-id id Id of the vps
13 --password password Password of the host (only useful in case of no reboot and vps)
14 --reinstall-first Start with reinstalling the vps
15 --host-user user Use another user than the default one
16 --no-reboot Don't reboot
17 --no-reboot-start Don't reboot to rescue at the beginning
18 --no-reboot-end Don't reboot to normal at the end
19 --git-branch branch Use another puppet branch (default: master)
20 --environment env Environment to use for the install (default: production)
27 environment
=production
36 if [ -z "$host_user" ]; then
39 if [ -z "$password" ]; then
42 [ -n "$T" ] && usage
&& exit 1
43 T
="ovh_cloud_instance"
48 if [ -z "$host_user" ]; then
51 [ -n "$T" ] && usage
&& exit 1
92 if [ -z "$T" -o -z "$host_id" ]; then
97 DIRECTORY
=$(cd `dirname $0` && pwd)
98 PYTHON_DIRECTORY
="$DIRECTORY/../python"
99 SCRIPTS
="$DIRECTORY/../scripts"
101 if [ -n "$reinstall_first" ]; then
102 echo "Réinstallation du système"
103 python
$PYTHON_DIRECTORY/reinstall_
$T.py
--use-current "$host_id"
105 read -p "Appuyer sur une touche quand le serveur est prêt" ready
108 if [ -z "$no_reboot" -a -z "$no_reboot_start" ]; then
109 echo "Patienter le temps du reboot"
110 python
$PYTHON_DIRECTORY/reboot_
$T.py
--rescue "$host_id"
112 read -p "Appuyer sur une touche quand l'instance a redémarré" ready
115 if [ -z "$password" ]; then
117 read -p "Mot de passe reçu par e-mail : " password
; echo
122 ARCH_HOST_SCRIPT
="$SCRIPTS/$T/arch_host_script.sh"
123 if [ -f "$SCRIPTS/$T/arch_chroot_script.sh" ]; then
124 ARCH_CHROOT_SCRIPT
="$SCRIPTS/$T/arch_chroot_script.sh"
126 ARCH_CHROOT_SCRIPT
=""
128 ARCH_INSTALL_SCRIPT
="$SCRIPTS/arch_install_script.sh"
129 ARCH_HOST_PUPPET_CONFIGURATION_SCRIPT
="$SCRIPTS/$T/arch_host_puppet_configuration_script.sh"
130 ARCH_PUPPET_CONFIGURATION_SCRIPT
="$SCRIPTS/arch_puppet_configuration_script.sh"
131 ARCH_PUPPET_INITIAL_CONFIGURATION
="$ARCH_DIR/puppet_variables.json"
133 trap "rm -rf $ARCH_DIR" EXIT
135 #### Base installation stage
136 python
$PYTHON_DIRECTORY/get_initial_configuration_
$T.py
$host_id > $ARCH_PUPPET_INITIAL_CONFIGURATION
137 host_address
=$(python $PYTHON_DIRECTORY/get_initial_configuration_$T.py $host_id | jq -r '.ips.v4.ipAddress')
139 dest
="$host_user@$host_address"
140 files
="$ARCH_HOST_SCRIPT $ARCH_CHROOT_SCRIPT $ARCH_PUPPET_INITIAL_CONFIGURATION $ARCH_INSTALL_SCRIPT"
142 $SCRIPTS/send_and_run.tcl
"$dest" "$password" "$git_branch" "$environment" $files
144 ### Role specific stage
145 read -p "Press key when LDAP is configured" i
147 files
="$ARCH_HOST_PUPPET_CONFIGURATION_SCRIPT $ARCH_PUPPET_CONFIGURATION_SCRIPT"
149 $SCRIPTS/send_and_run.tcl
"$dest" "$password" "$git_branch" "$environment" $files
151 ### Installation finished
152 if [ -z "$no_reboot" -a -z "$no_reboot_end" ]; then
154 python
$PYTHON_DIRECTORY/reboot_
$T.py
--local "$host_id"