diff options
Diffstat (limited to 'mcp/reclass/scripts')
-rwxr-xr-x | mcp/reclass/scripts/infra.sh | 9 | ||||
-rwxr-xr-x | mcp/reclass/scripts/salt.sh | 7 | ||||
-rw-r--r--[-rwxr-xr-x] | mcp/reclass/scripts/user-data.template (renamed from mcp/reclass/scripts/user-data.sh) | 4 |
3 files changed, 13 insertions, 7 deletions
diff --git a/mcp/reclass/scripts/infra.sh b/mcp/reclass/scripts/infra.sh index b83f21508..c88c061fd 100755 --- a/mcp/reclass/scripts/infra.sh +++ b/mcp/reclass/scripts/infra.sh @@ -1,7 +1,7 @@ #!/bin/bash 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 ) +declare -A NODES=( [cfg01]=4096 [ctl01]=8192 [ctl02]=8192 [ctl03]=8192 [gtw01]=2048 [cmp01]=6144 ) # get required packages apt-get install -y mkisofs curl virtinst cpu-checker qemu-kvm @@ -13,6 +13,9 @@ apt-get install -y mkisofs curl virtinst cpu-checker qemu-kvm mkdir -p images wget -P /tmp -nc $BASE_IMAGE +# generate cloud-init user data +envsubst < user-data.template > user-data.sh + for node in "${!NODES[@]}"; do # clean up existing nodes if [ "$(virsh domstate $node 2>/dev/null)" == 'running' ]; then @@ -60,8 +63,8 @@ for node in "${!NODES[@]}"; do sleep $[RANDOM%5+1] done -CONNECTION_ATTEMPTS=20 -SLEEP=15 +CONNECTION_ATTEMPTS=60 +SLEEP=5 # wait until ssh on Salt master is available echo "Attempting to ssh to Salt master ..." diff --git a/mcp/reclass/scripts/salt.sh b/mcp/reclass/scripts/salt.sh index 6c60c5662..b6f844e83 100755 --- a/mcp/reclass/scripts/salt.sh +++ b/mcp/reclass/scripts/salt.sh @@ -7,7 +7,10 @@ ssh $SSH_OPTS ubuntu@$SALT_MASTER bash -s << SALT_INSTALL_END sudo -i - apt-get update + echo -n 'Checking out cloud-init has finished running ...' + while [ ! -f /var/lib/cloud/instance/boot-finished ]; do echo -n '.'; sleep 1; done + echo ' done' + apt-get install -y git curl subversion svn export --force https://github.com/salt-formulas/salt-formulas/trunk/deploy/scripts /srv/salt/scripts @@ -15,6 +18,6 @@ ssh $SSH_OPTS ubuntu@$SALT_MASTER bash -s << SALT_INSTALL_END 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 + MASTER_HOSTNAME=cfg01.${CLUSTER_DOMAIN} ./salt-master-init.sh salt-key -Ay SALT_INSTALL_END diff --git a/mcp/reclass/scripts/user-data.sh b/mcp/reclass/scripts/user-data.template index 2b9b6845c..811a58c70 100755..100644 --- a/mcp/reclass/scripts/user-data.sh +++ b/mcp/reclass/scripts/user-data.template @@ -5,6 +5,6 @@ apt update apt-get install -y salt-minion rm /etc/salt/minion_id rm -f /etc/salt/pki/minion/minion_master.pub -echo "id: $(hostname).virtual-mcp-ocata-ovs.local" > /etc/salt/minion -echo "master: 192.168.10.100" >> /etc/salt/minion +echo "id: $(hostname).${CLUSTER_DOMAIN}" > /etc/salt/minion +echo "master: ${SALT_MASTER}" >> /etc/salt/minion service salt-minion restart |