From 5187d6ed8d485729aa2d34cb040b26c12a6e69ad Mon Sep 17 00:00:00 2001 From: Dan Radez Date: Wed, 6 Jul 2016 09:35:07 -0400 Subject: Splitting post-install into functions file trying to reduce the monolith deploy.sh to smaller parts Change-Id: Ie7068473e4ddd8eeca28ebd03de57781222ad761 Signed-off-by: Dan Radez --- lib/post-install-functions.sh | 153 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100755 lib/post-install-functions.sh (limited to 'lib/post-install-functions.sh') diff --git a/lib/post-install-functions.sh b/lib/post-install-functions.sh new file mode 100755 index 00000000..f52e28e1 --- /dev/null +++ b/lib/post-install-functions.sh @@ -0,0 +1,153 @@ +#!/usr/bin/env bash +############################################################################## +# Copyright (c) 2015 Tim Rozet (Red Hat), Dan Radez (Red Hat) and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +##Post configuration after install +##params: none +function configure_post_install { + local opnfv_attach_networks ovs_ip ip_range net_cidr tmp_ip + opnfv_attach_networks="admin_network public_network" + + echo -e "${blue}INFO: Post Install Configuration Running...${reset}" + + echo -e "${blue}INFO: Configuring ssh for root to overcloud nodes...${reset}" + # copy host key to instack + scp ${SSH_OPTIONS[@]} /root/.ssh/id_rsa.pub "stack@$UNDERCLOUD":jumphost_id_rsa.pub + + # add host key to overcloud nodes authorized keys + ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" << EOI +source stackrc +nodes=\$(nova list | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+") +for node in \$nodes; do +cat ~/jumphost_id_rsa.pub | ssh -T ${SSH_OPTIONS[@]} "heat-admin@\$node" 'cat >> ~/.ssh/authorized_keys' +done +EOI + + if [ "${deploy_options_array['dataplane']}" == 'ovs_dpdk' ]; then + echo -e "${blue}INFO: Bringing up br-phy and ovs-agent for dpdk compute nodes...${reset}" + compute_nodes=$(undercloud_connect stack "source stackrc; nova list | grep compute | wc -l") + i=0 + while [ "$i" -lt "$compute_nodes" ]; do + overcloud_connect compute${i} "sudo ifup br-phy; sudo systemctl restart neutron-openvswitch-agent" + i=$((i + 1)) + done + fi + + ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <