Bridged public network -> need Ubuntu 16.04

This commit is contained in:
Denis Lambolez
2017-12-11 19:00:36 +01:00
parent c64a50bb5e
commit 453ea43d87
6 changed files with 75 additions and 38 deletions
+21 -6
View File
@@ -32,12 +32,27 @@ GUEST_USER_DIR="/home/$CEPH_ADMIN_USER"
GUEST_USER_SSH_DIR="$GUEST_USER_DIR/.ssh"
GUEST_VAGRANT_SCRIPT_DIR="/vagrant/scripts"
GUEST_VAGRANT_SSH_DIR="/vagrant/.ssh"
# Network (dynamically defined by Vagrant)
IP_ADDRESS=$(ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)
PUBLIC_NETWORK=$(echo $IP_ADDRESS | awk -F '.' '{print $1"."$2"."$3".0"}')
# Make sure only CEPH_ADMIN_USER can run the script
if [[ $(whoami) != $CEPH_ADMIN_USER ]]; then
echo "This script must be run as $CEPH_ADMIN_USER" 1>&2
exit 1
fi
# Cluster configuration directory
mkdir -p "$GUEST_USER_DIR/ceph-cluster"
cd "$GUEST_USER_DIR/ceph-cluster"
#ceph-deploy new node-admin
#echo "public network = $PUBLIC_NETWORK" >> ceph.conf
#echo "cluster network = $CLUSTER_NETWORK" >> ceph.conf
#echo "" >> ceph.conf
#echo "osd pool default size = 2" >> ceph.conf
#echo "osd pool default min size = 1" >> ceph.conf
# Initialize cluster configuration
ceph-deploy new node-admin
echo "public network = $PUBLIC_NETWORK" >> ceph.conf
echo "cluster network = $CLUSTER_NETWORK" >> ceph.conf
echo "" >> ceph.conf
echo "osd pool default size = 2" >> ceph.conf
echo "osd pool default min size = 1" >> ceph.conf
# Install ceph on all nodes
ceph-deploy install --release luminous node-admin node-osd1 node-osd2
+16 -5
View File
@@ -60,7 +60,7 @@ $CEPH_ADMIN_EXEC rm -f "$GUEST_USER_SSH_DIR/authorized_keys"
$CEPH_ADMIN_EXEC cp "$GUEST_VAGRANT_SSH_DIR/$CEPH_ADMIN_USER-id_rsa.pub" "$GUEST_USER_SSH_DIR/authorized_keys"
$CEPH_ADMIN_EXEC chmod 644 "$GUEST_USER_SSH_DIR/authorized_keys"
# Make debconf non interactive
# Make debconf non interactive and set the right local
export DEBIAN_FRONTEND=noninteractive
# Install ceph repository
@@ -68,14 +68,25 @@ wget -q -O- 'https://download.ceph.com/keys/release.asc' | apt-key add -
echo deb https://download.ceph.com/debian/ $(lsb_release -sc) main | tee /etc/apt/sources.list.d/ceph.list
apt-get update
# Install chrony (time synchronization) and ceph-deploy
apt-get -y install chrony ceph-deploy
# Install chrony for time synchronization, gdisk for GPT partitioning,
# vnstat for network stats, htop for system monitor and ceph-deploy
apt-get -y install chrony gdisk vnstat htop ceph-deploy
# Modify /etc/hosts to allow ceph-deploy to resolve the guest
# Need to replace the loopback address by the real address
GUEST_NAME=$(hostname -s)
GUEST_IP=$(ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)
sed -i "s/127.0.0.1\t$GUEST_NAME\t$GUEST_NAME/$GUEST_IP\t$GUEST_NAME\t$GUEST_NAME/g" /etc/hosts
IP_ADDRESS=$(ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)
sed -i "s/127.0.0.1\t$GUEST_NAME\t$GUEST_NAME/$IP_ADDRESS\t$GUEST_NAME\t$GUEST_NAME/g" /etc/hosts
# Create partitions on journal disk for osd nodes only
for NODE in $OSD_NODES; do
if [[ NODE == $GUEST_NAME ]]; then
sgdisk --new=0:0:10G /dev/vda > /dev/null 2>&1
sgdisk --new=0:0:20G /dev/vda > /dev/null 2>&1
sgdisk --largest-new=0 /dev/vda > /dev/null 2>&1
sgdisk --print /dev/vda
fi
done
# Full update
#apt-get -y dist-upgrade
+5 -1
View File
@@ -29,6 +29,10 @@ CEPH_ADMIN_USER="ceph-admin"
CEPH_ADMIN_EXEC="sudo -i -u $CEPH_ADMIN_USER"
# Machines
NODES="node-admin node-osd1 node-osd2"
ADMIN_NODE="node-admin"
OSD_NODES="node-osd1 node-osd2"
NODES="$ADMIN_NODE $OSD_NODES"
# Networks
CLUSTER_NETWORK="172.28.128.0"