ceph-vagrant/scripts/pre-up.sh

51 lines
2.1 KiB
Bash
Raw Normal View History

2017-12-03 19:19:25 +00:00
#!/bin/bash
# ========================================================================================
# Execute pre-up configuration needed to deploy vagrant cluster
2017-12-03 19:19:25 +00:00
#
# Written by : Denis Lambolez
# Release : 2.0
# Creation date : 16 December 2017
2017-12-03 19:19:25 +00:00
# Description : Bash script
# This script has been designed and written on Ubuntu 16.04 plateform.
# It must be executed in vagrant context
# Usage : ./pre-up.sh
2017-12-03 19:19:25 +00:00
# ----------------------------------------------------------------------------------------
# ========================================================================================
#
# HISTORY :
# Release | Date | Authors | Description
# --------------+---------------+--------------- +------------------------------------------
# 2.0 | 12.16.17 | Denis Lambolez | Renamed pre-up.sh and linked to post-destroy
2017-12-03 19:19:25 +00:00
# 1.1 | 12.04.17 | Denis Lambolez | Sourcing parameters from cephtest-utils
# 1.0 | 12.02.17 | Denis Lambolez | Creation
# | | |
# =========================================================================================
#set -xev
# Version
VERSION=pre-up-2.0-121617
2017-12-03 19:19:25 +00:00
# This script is executed in host context
source "$(dirname "$(readlink -f "$0")")/cephtest-utils.sh"
# (re)Create ssh keys
2017-12-25 20:44:04 +00:00
$OUTPUT_LOG "Create SSH keys and config for ceph admin user"
2017-12-03 19:19:25 +00:00
rm -f "$HOST_SSH_DIR/$CEPH_ADMIN_USER"-id_rsa*
ssh-keygen -q -N "" -f "$HOST_SSH_DIR/$CEPH_ADMIN_USER-id_rsa"
chmod 644 "$HOST_SSH_DIR/$CEPH_ADMIN_USER-id_rsa"
chmod 644 "$HOST_SSH_DIR/$CEPH_ADMIN_USER-id_rsa.pub"
# (re)Create ssh config file
rm -f "$HOST_SSH_DIR/$CEPH_ADMIN_USER-config"
for NODE in $NODES; do
2017-12-25 20:44:04 +00:00
echo -e "Host $NODE\n\tHostname $NODE\n\tUser $CEPH_ADMIN_USER\n\tStrictHostKeyChecking no\n" | tee -a "$HOST_SSH_DIR/$CEPH_ADMIN_USER-config"
2017-12-03 19:19:25 +00:00
done
chmod 644 "$HOST_SSH_DIR/$CEPH_ADMIN_USER-config"
# Clean up IP and PROVISION signals
2017-12-25 20:44:04 +00:00
$OUTPUT_LOG "Clean up IP and PROVISION signals"
for NODE in $NODES; do
rm -f "$HOST_SIGNAL_DIR/$NODE-IP"
rm -f "$HOST_SIGNAL_DIR/$NODE-PROVISION"
done