aboutsummaryrefslogtreecommitdiffstats
path: root/mcp
diff options
context:
space:
mode:
authorMichael Polenchuk <mpolenchuk@mirantis.com>2017-05-29 13:36:25 +0400
committerMichael Polenchuk <mpolenchuk@mirantis.com>2017-05-29 15:02:16 +0400
commitecfbd90af36439bcb51ec2cace0d0d2340e9fee1 (patch)
treeeadcf7cc49c6a7f6932ed44f528b33c03f180551 /mcp
parentf85c84133c2f8d6aec3c707cfb92cb03db543bd6 (diff)
[mcp] Mend installation scripts
* add/unify ssh options * get base image to temporary directory * specify os type for virt install * fix symbolic link to reclass * remove outdated fuel submodules Change-Id: I6833ce78c8fff97e1b89f4e92e6e6b470e9ce99f Signed-off-by: Michael Polenchuk <mpolenchuk@mirantis.com>
Diffstat (limited to 'mcp')
-rwxr-xr-xmcp/reclass/scripts/infra.sh13
-rwxr-xr-xmcp/reclass/scripts/openstack.sh2
-rwxr-xr-xmcp/reclass/scripts/salt.sh4
3 files changed, 7 insertions, 12 deletions
diff --git a/mcp/reclass/scripts/infra.sh b/mcp/reclass/scripts/infra.sh
index 7f5c210db..b83f21508 100755
--- a/mcp/reclass/scripts/infra.sh
+++ b/mcp/reclass/scripts/infra.sh
@@ -1,7 +1,5 @@
#!/bin/bash
-SSH_KEY=mcp.rsa
-SALT_MASTER=192.168.10.100
BASE_IMAGE=https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img
declare -A NODES=( [cfg01]=4096 [ctl01]=6144 [ctl02]=6144 [ctl03]=6144 [gtw01]=2048 [cmp01]=2048 )
@@ -13,7 +11,7 @@ apt-get install -y mkisofs curl virtinst cpu-checker qemu-kvm
# get base image
mkdir -p images
-wget -nc $BASE_IMAGE
+wget -P /tmp -nc $BASE_IMAGE
for node in "${!NODES[@]}"; do
# clean up existing nodes
@@ -24,7 +22,7 @@ for node in "${!NODES[@]}"; do
# create/prepare images
[ -f images/mcp_${node}.iso ] || ./create-config-drive.sh -k ${SSH_KEY}.pub -u user-data.sh -h ${node} images/mcp_${node}.iso
- cp ${BASE_IMAGE/*\/} images/mcp_${node}.qcow2
+ cp /tmp/${BASE_IMAGE/*\/} images/mcp_${node}.qcow2
qemu-img resize images/mcp_${node}.qcow2 100G
done
@@ -47,6 +45,7 @@ for node in "${!NODES[@]}"; do
--network network:internal,model=virtio \
--network network:public,model=virtio \
--disk path=$(pwd)/images/mcp_${node}.qcow2,format=qcow2,bus=virtio,cache=none,io=native \
+ --os-type linux --os-variant none \
--boot hd --vnc --console pty --autostart --noreboot \
--disk path=$(pwd)/images/mcp_${node}.iso,device=cdrom
done
@@ -64,20 +63,16 @@ done
CONNECTION_ATTEMPTS=20
SLEEP=15
-# refresh salt master host key
-ssh-keygen -R $SALT_MASTER
-
# wait until ssh on Salt master is available
echo "Attempting to ssh to Salt master ..."
ATTEMPT=1
while (($ATTEMPT <= $CONNECTION_ATTEMPTS)); do
- ssh -i ${SSH_KEY} ubuntu@$SALT_MASTER uptime
+ ssh $SSH_OPTS ubuntu@$SALT_MASTER uptime
case $? in
(0) echo "${ATTEMPT}> Success"; break ;;
(*) echo "${ATTEMPT}/${CONNECTION_ATTEMPTS}> ssh server ain't ready yet, waiting for ${SLEEP} seconds ..." ;;
esac
sleep $SLEEP
- ssh-keyscan -t ecdsa $SALT_MASTER >> ~/.ssh/known_hosts
((ATTEMPT+=1))
done
diff --git a/mcp/reclass/scripts/openstack.sh b/mcp/reclass/scripts/openstack.sh
index b757e8ecf..3f6b0617c 100755
--- a/mcp/reclass/scripts/openstack.sh
+++ b/mcp/reclass/scripts/openstack.sh
@@ -3,7 +3,7 @@
# Deploy Openstack
#
-ssh -i mcp.rsa ubuntu@192.168.10.100 bash -s << OPENSTACK_INSTALL_END
+ssh $SSH_OPTS ubuntu@$SALT_MASTER bash -s << OPENSTACK_INSTALL_END
sudo -i
salt-call state.apply salt
diff --git a/mcp/reclass/scripts/salt.sh b/mcp/reclass/scripts/salt.sh
index 6495bbce2..6c60c5662 100755
--- a/mcp/reclass/scripts/salt.sh
+++ b/mcp/reclass/scripts/salt.sh
@@ -4,7 +4,7 @@
#
# ssh to cfg01
-ssh -i mcp.rsa ubuntu@192.168.10.100 bash -s << SALT_INSTALL_END
+ssh $SSH_OPTS ubuntu@$SALT_MASTER bash -s << SALT_INSTALL_END
sudo -i
apt-get update
@@ -12,7 +12,7 @@ ssh -i mcp.rsa ubuntu@192.168.10.100 bash -s << SALT_INSTALL_END
svn export --force https://github.com/salt-formulas/salt-formulas/trunk/deploy/scripts /srv/salt/scripts
git clone --depth=1 --recurse-submodules https://git.opnfv.org/fuel
- ln -s $(pwd)/fuel/mcp/reclass /srv/salt/reclass
+ ln -s /root/fuel/mcp/reclass /srv/salt/reclass
cd /srv/salt/scripts
MASTER_HOSTNAME=cfg01.virtual-mcp-ocata-ovs.local ./salt-master-init.sh