5 $(basename $0) [options]
8 Please chose environment:
9 --environment env Environment to use for the install
11 One of the following options is necessary:
12 --instance-id id Id of the cloud instance
13 --vps-id id Id of the vps
16 --password password Password of the host (only useful in case of no reboot and vps)
17 --reinstall-first Start with reinstalling the vps
18 --host-user user Use another user than the default one
19 --no-reboot Don't reboot
20 --no-reboot-start Don't reboot to rescue at the beginning
21 --no-reboot-end Don't reboot to normal at the end
22 --git-branch branch Use another puppet branch (default: master)
37 if [ -z "$host_user" ]; then
40 if [ -z "$password" ]; then
43 [ -n "$T" ] && usage
&& exit 1
44 T
="ovh_cloud_instance"
49 if [ -z "$host_user" ]; then
52 [ -n "$T" ] && usage
&& exit 1
93 if [ -z "$T" -o -z "$host_id" -o -z "$environment" ]; then
98 DIRECTORY
=$(cd `dirname $0` && pwd)
99 PYTHON_DIRECTORY
="$DIRECTORY/../python"
100 SCRIPTS
="$DIRECTORY/../scripts"
102 if [ -n "$reinstall_first" ]; then
103 echo "Réinstallation du système"
104 python
$PYTHON_DIRECTORY/reinstall_
$T.py
--use-current "$host_id"
106 read -p "Appuyer sur une touche quand le serveur est prêt" ready
109 if [ -z "$no_reboot" -a -z "$no_reboot_start" ]; then
110 echo "Patienter le temps du reboot"
111 python
$PYTHON_DIRECTORY/reboot_
$T.py
--rescue "$host_id"
113 read -p "Appuyer sur une touche quand l'instance a redémarré" ready
116 if [ -z "$password" ]; then
118 read -p "Mot de passe reçu par e-mail : " password
; echo
123 ARCH_HOST_SCRIPT
="$SCRIPTS/$T/arch_host_script.sh"
124 if [ -f "$SCRIPTS/$T/arch_chroot_script.sh" ]; then
125 ARCH_CHROOT_SCRIPT
="$SCRIPTS/$T/arch_chroot_script.sh"
127 ARCH_CHROOT_SCRIPT
=""
129 ARCH_INSTALL_SCRIPT
="$SCRIPTS/arch_install_script.sh"
130 ARCH_HOST_PUPPET_CONFIGURATION_SCRIPT
="$SCRIPTS/$T/arch_host_puppet_configuration_script.sh"
131 ARCH_PUPPET_CONFIGURATION_SCRIPT
="$SCRIPTS/arch_puppet_configuration_script.sh"
132 ARCH_PUPPET_INITIAL_CONFIGURATION
="$ARCH_DIR/puppet_variables.json"
134 trap "rm -rf $ARCH_DIR" EXIT
136 #### Base installation stage
137 python
$PYTHON_DIRECTORY/get_initial_configuration_
$T.py
$host_id > $ARCH_PUPPET_INITIAL_CONFIGURATION
138 host_address
=$(python $PYTHON_DIRECTORY/get_initial_configuration_$T.py $host_id | jq -r '.ips.v4.ipAddress')
140 dest
="$host_user@$host_address"
141 files
="$ARCH_HOST_SCRIPT $ARCH_CHROOT_SCRIPT $ARCH_PUPPET_INITIAL_CONFIGURATION $ARCH_INSTALL_SCRIPT"
143 $SCRIPTS/send_and_run.tcl
"$dest" "$password" "$git_branch" "$environment" $files
145 ### Role specific stage
146 read -p "Press key when LDAP is configured" i
148 files
="$ARCH_HOST_PUPPET_CONFIGURATION_SCRIPT $ARCH_PUPPET_CONFIGURATION_SCRIPT"
150 $SCRIPTS/send_and_run.tcl
"$dest" "$password" "$git_branch" "$environment" $files
152 ### Installation finished
153 if [ -z "$no_reboot" -a -z "$no_reboot_end" ]; then
155 python
$PYTHON_DIRECTORY/reboot_
$T.py
--local "$host_id"