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
14 --hetzner-id id Id of the Hetzner server
17 --password password Password of the host (only useful in case of no reboot and vps)
18 --reinstall-first Start with reinstalling the vps
19 --host-user user Use another user than the default one
20 --no-reboot Don't reboot
21 --no-reboot-start Don't reboot to rescue at the beginning
22 --no-reboot-end Don't reboot to normal at the end
23 --git-branch branch Use another puppet branch (default: master)
38 if [ -z "$host_user" ]; then
41 if [ -z "$password" ]; then
44 [ -n "$T" ] && usage
&& exit 1
45 T
="ovh_cloud_instance"
50 if [ -z "$host_user" ]; then
53 [ -n "$T" ] && usage
&& exit 1
59 if [ -z "$host_user" ]; then
62 [ -n "$T" ] && usage
&& exit 1
103 if [ -z "$T" -o -z "$host_id" -o -z "$environment" ]; then
108 DIRECTORY
=$(cd `dirname $0` && pwd)
109 PYTHON_DIRECTORY
="$DIRECTORY/../python"
110 SCRIPTS
="$DIRECTORY/../scripts"
112 if [ -n "$reinstall_first" ]; then
113 echo "Réinstallation du système"
114 python
$PYTHON_DIRECTORY/reinstall_
$T.py
--use-current "$host_id"
116 read -p "Appuyer sur une touche quand le serveur est prêt" ready
119 if [ -z "$no_reboot" -a -z "$no_reboot_start" ]; then
120 echo "Patienter le temps du reboot"
121 python
$PYTHON_DIRECTORY/reboot_
$T.py
--rescue "$host_id"
123 read -p "Appuyer sur une touche quand l'instance a redémarré" ready
126 if [ -z "$password" ]; then
128 read -p "Mot de passe reçu par e-mail : " password
; echo
133 ARCH_HOST_SCRIPT
="$SCRIPTS/$T/arch_host_script.sh"
134 if [ -f "$SCRIPTS/$T/arch_chroot_script.sh" ]; then
135 ARCH_CHROOT_SCRIPT
="$SCRIPTS/$T/arch_chroot_script.sh"
137 ARCH_CHROOT_SCRIPT
=""
139 ARCH_INSTALL_SCRIPT
="$SCRIPTS/arch_install_script.sh"
140 ARCH_HOST_PUPPET_CONFIGURATION_SCRIPT
="$SCRIPTS/$T/arch_host_puppet_configuration_script.sh"
141 ARCH_PUPPET_CONFIGURATION_SCRIPT
="$SCRIPTS/arch_puppet_configuration_script.sh"
142 ARCH_PUPPET_INITIAL_CONFIGURATION
="$ARCH_DIR/puppet_variables.json"
144 trap "rm -rf $ARCH_DIR" EXIT
146 #### Base installation stage
147 python
$PYTHON_DIRECTORY/get_initial_configuration_
$T.py
$host_id > $ARCH_PUPPET_INITIAL_CONFIGURATION
148 host_address
=$(python $PYTHON_DIRECTORY/get_initial_configuration_$T.py $host_id | jq -r '.ips.v4.ipAddress')
150 dest
="$host_user@$host_address"
151 files
="$ARCH_HOST_SCRIPT $ARCH_CHROOT_SCRIPT $ARCH_PUPPET_INITIAL_CONFIGURATION $ARCH_INSTALL_SCRIPT"
153 $SCRIPTS/send_and_run.tcl
"$dest" "$password" "$git_branch" "$environment" $files
155 ### Role specific stage
156 read -p "Press key when LDAP is configured" i
158 files
="$ARCH_HOST_PUPPET_CONFIGURATION_SCRIPT $ARCH_PUPPET_CONFIGURATION_SCRIPT"
160 $SCRIPTS/send_and_run.tcl
"$dest" "$password" "$git_branch" "$environment" $files
162 ### Installation finished
163 if [ -z "$no_reboot" -a -z "$no_reboot_end" ]; then
165 python
$PYTHON_DIRECTORY/reboot_
$T.py
--local "$host_id"