Refactor setup process
* Seperate out xs-tools.iso install * Fix astute section fetch + Add Mac address display on preparation + Revise remote ssh scripting
This commit is contained in:
parent
d01d50b392
commit
ec3b8efb57
42
deploy.sh
42
deploy.sh
|
@ -1,46 +1,50 @@
|
|||
source localrc
|
||||
|
||||
ACTION=${1:-"all"}
|
||||
TMP="/tmp"
|
||||
|
||||
[ -e "$VIRENV_PATH/bin/activate" ] || virtualenv "$VIRENV_PATH"
|
||||
|
||||
source $VIRENV_PATH/bin/activate
|
||||
|
||||
function deploy_release {
|
||||
scp cleardb.py root@$FUELMASTER:$TMP
|
||||
ssh root@$FUELMASTER dockerctl copy "$TMP/cleardb.py" nailgun:/tmp/cleardb.py
|
||||
ssh root@$FUELMASTER dockerctl shell nailgun /tmp/cleardb.py
|
||||
ssh root@$FUELMASTER rm "$TMP/cleardb.py"
|
||||
|
||||
sshpass -p $XEN_PASSWORD scp cleardb.py root@$FUELMASTER:/tmp
|
||||
sshpass -p $XEN_PASSWORD ssh $XEN_ROOT@$FUELMASTER \
|
||||
'
|
||||
dockerctl copy "/tmp/cleardb.py" nailgun:/tmp/cleardb.py
|
||||
dockerctl shell nailgun /tmp/cleardb.py
|
||||
rm "/tmp/cleardb.py"
|
||||
'
|
||||
cat base_release.yaml > newrelease.yaml
|
||||
echo '- pk: 9' >> newrelease.yaml
|
||||
echo ' extend: *base_release' >> newrelease.yaml
|
||||
cat xs_release.yaml >> newrelease.yaml
|
||||
scp newrelease.yaml root@$FUELMASTER:$TMP
|
||||
ssh root@$FUELMASTER dockerctl copy "$TMP/newrelease.yaml" nailgun:/tmp/newrelease.yaml
|
||||
ssh root@$FUELMASTER dockerctl shell nailgun manage.py loaddata /tmp/newrelease.yaml
|
||||
ssh root@$FUELMASTER fuel rel --sync-deployment-tasks --dir /etc/puppet/
|
||||
sshpass -p $XEN_PASSWORD scp newrelease.yaml root@$FUELMASTER:/tmp
|
||||
sshpass -p $XEN_PASSWORD ssh $XEN_ROOT@$FUELMASTER \
|
||||
'
|
||||
dockerctl copy "/tmp/newrelease.yaml" nailgun:/tmp/newrelease.yaml
|
||||
dockerctl shell nailgun manage.py loaddata /tmp/newrelease.yaml
|
||||
fuel rel --sync-deployment-tasks --dir /etc/puppet/
|
||||
rm "/tmp/newrelease.yaml"
|
||||
'
|
||||
rm newrelease.yaml
|
||||
ssh root@$FUELMASTER rm "$TMP/newrelease.yaml"
|
||||
}
|
||||
|
||||
function deploy_plugin {
|
||||
fpb --check xenserver-fuel-plugin
|
||||
fpb --build xenserver-fuel-plugin
|
||||
|
||||
scp xenserver-fuel-plugin/xenserver-fuel-plugin-0.0-$VERSION-1.noarch.rpm root@$FUELMASTER:$TMP
|
||||
sshpass -p $XEN_PASSWORD scp xenserver-fuel-plugin/xenserver-fuel-plugin-0.0-$VERSION-1.noarch.rpm root@$FUELMASTER:/tmp
|
||||
|
||||
#ssh root@$FUELMASTER fuel plugins --remove xenserver-fuel-plugin==$VERSION
|
||||
if ssh root@$FUELMASTER fuel plugins --list | grep xenserver-fuel-plugin; then
|
||||
#ssh root@$FUELMASTER fuel plugins --update "$TMP/xenserver-fuel-plugin-0.0-$VERSION-1.noarch.rpm"
|
||||
ssh root@$FUELMASTER fuel plugins --remove "xenserver-fuel-plugin==$VERSION"
|
||||
ssh root@$FUELMASTER fuel plugins --install "$TMP/xenserver-fuel-plugin-0.0-$VERSION-1.noarch.rpm"
|
||||
#sshpass -p $XEN_PASSWORD ssh $XEN_ROOT@$FUELMASTER fuel plugins --remove xenserver-fuel-plugin==$VERSION
|
||||
if sshpass -p $XEN_PASSWORD ssh $XEN_ROOT@$FUELMASTER fuel plugins --list | grep xenserver-fuel-plugin; then
|
||||
#sshpass -p $XEN_PASSWORD ssh $XEN_ROOT@$FUELMASTER fuel plugins --update "/tmp/xenserver-fuel-plugin-0.0-$VERSION-1.noarch.rpm"
|
||||
sshpass -p $XEN_PASSWORD ssh $XEN_ROOT@$FUELMASTER fuel plugins --remove "xenserver-fuel-plugin==$VERSION"
|
||||
sshpass -p $XEN_PASSWORD ssh $XEN_ROOT@$FUELMASTER fuel plugins --install "/tmp/xenserver-fuel-plugin-0.0-$VERSION-1.noarch.rpm"
|
||||
else
|
||||
ssh root@$FUELMASTER fuel plugins --install "$TMP/xenserver-fuel-plugin-0.0-$VERSION-1.noarch.rpm"
|
||||
sshpass -p $XEN_PASSWORD ssh $XEN_ROOT@$FUELMASTER fuel plugins --install "/tmp/xenserver-fuel-plugin-0.0-$VERSION-1.noarch.rpm"
|
||||
fi
|
||||
|
||||
ssh root@$FUELMASTER rm "$TMP/xenserver-fuel-plugin-0.0-$VERSION-1.noarch.rpm"
|
||||
sshpass -p $XEN_PASSWORD ssh $XEN_ROOT@$FUELMASTER rm "/tmp/xenserver-fuel-plugin-0.0-$VERSION-1.noarch.rpm"
|
||||
}
|
||||
case $ACTION in
|
||||
"release") deploy_release ;;
|
||||
|
|
|
@ -1,11 +1,22 @@
|
|||
VERSION="0.0.3"
|
||||
|
||||
ENV_NAME="test_env"
|
||||
FUELMASTER="HOST_OF_FUEL_MASTER"
|
||||
FUELMASTER_ROOT="root"
|
||||
FUELMASTER_PASSWORD="r00tme"
|
||||
|
||||
VIRENV_PATH="../MOS"
|
||||
FPB_PATH="../fuel-plugins"
|
||||
|
||||
XEN_ROOT="root"
|
||||
XEN_PASSWORD="PASSWORD"
|
||||
XEN_PASSWORD="XEN_PASSWORD"
|
||||
|
||||
CONTROLLER_NODES="XENSERVER_HOST_1/NODE_NAME_1"
|
||||
COMPUTE_NODES="XENSERVER_HOST_1/NODE_NAME_2,\
|
||||
XENSERVER_HOST_2/NODE_NAME_3,\
|
||||
XENSERVER_HOST_3/NODE_NAME_4"
|
||||
STORAGE_NODES="XENSERVER_HOST_4/NODE_NAME_5"
|
||||
NODE_ETH0="NODE_ETH0"
|
||||
NODE_ETH1="NODE_ETH1"
|
||||
NODE_MEMORY="2048"
|
||||
NODE_DISKSIZE="40"
|
|
@ -1,8 +1,8 @@
|
|||
source localrc
|
||||
|
||||
ALL_NODES="$CONTROLLER_NODES,$COMPUTE_NODES,$STORAGE_NODES"
|
||||
echo "Setting up HIMN"
|
||||
|
||||
for HOST_NODE in ${ALL_NODES//,/ }
|
||||
for HOST_NODE in ${COMPUTE_NODES//,/ }
|
||||
do
|
||||
IFS=/ read -a _HOST_NODE <<< $HOST_NODE
|
||||
HOST=${_HOST_NODE[0]}
|
||||
|
@ -16,12 +16,17 @@ if [ -n "$vm_uuid" ]; then
|
|||
net_uuid=$(xe network-list bridge=xenapi minimal=true)
|
||||
vif_uuid=$(xe vif-list network-uuid="$net_uuid" vm-uuid="$vm_uuid" --minimal)
|
||||
if [ -z "$vif_uuid" ]; then
|
||||
|
||||
eth2_uuid=$(xe vif-create network-uuid="$net_uuid" vm-uuid="$vm_uuid" device="$device_number")
|
||||
xe vif-plug uuid="$eth2_uuid"
|
||||
echo "$vm_name : HIMN created"
|
||||
|
||||
_vm=$(xe vif-plug uuid="$eth2_uuid")
|
||||
echo "$vm_name : HIMN plugged"
|
||||
#You attempted an operation on a VM which requires PV drivers to be installed but the drivers were not detected.
|
||||
fi
|
||||
other_config=$(xe network-param-get param-name="other-config" uuid="$net_uuid")
|
||||
if [[ "$other_config" == "*is_guest_installer_network*" ]]; then
|
||||
echo "$vm_name : exposing HIMN"
|
||||
xe network-param-remove param-name="other-config" param-key="is_guest_installer_network" uuid="$net_uuid"
|
||||
fi
|
||||
else
|
||||
|
|
|
@ -10,7 +10,7 @@ from tempfile import mkstemp, mkdtemp
|
|||
|
||||
LOG_FILE = '/tmp/compute_post_deployment.log'
|
||||
ASTUTE_PATH = '/etc/astute.yaml'
|
||||
ACCESS_SECTION = 'xen-fuel-plugin'
|
||||
ACCESS_SECTION = 'xenserver-fuel-plugin'
|
||||
XENAPI_URL = 'https://pypi.python.org/packages/source/X/XenAPI/XenAPI-1.2.tar.gz'
|
||||
|
||||
logging.basicConfig(filename=LOG_FILE,level=logging.DEBUG)
|
||||
|
@ -30,9 +30,6 @@ def get_access(astute_path, access_section):
|
|||
info('password: {password}'.format(**access))
|
||||
return access
|
||||
|
||||
def install_xentools():
|
||||
os.system('mount /dev/cdrom /mnt && /mnt/Linux/install.sh')
|
||||
|
||||
def init_eth(dev_no):
|
||||
fname = '/etc/network/interfaces.d/ifcfg-eth%d' % (dev_no)
|
||||
s = \
|
||||
|
|
|
@ -1,29 +1,23 @@
|
|||
# This tasks will be applied on controller nodes,
|
||||
# here you can also specify several roles, for example
|
||||
# ['cinder', 'compute'] will be applied only on
|
||||
# cinder and compute nodes
|
||||
- role: '*'
|
||||
stage: pre_deployment/6000
|
||||
type: shell
|
||||
parameters:
|
||||
cmd: 'mount /dev/cdrom /mnt && /mnt/Linux/install.sh -n'
|
||||
timeout: 60
|
||||
- role: '*'
|
||||
stage: pre_deployment/7000
|
||||
type: reboot
|
||||
parameters:
|
||||
timeout: 300
|
||||
- role: ['controller']
|
||||
stage: post_deployment
|
||||
type: shell
|
||||
parameters:
|
||||
cmd: ./controller_post_deployment.sh
|
||||
timeout: 42
|
||||
timeout: 60
|
||||
- role: ['compute']
|
||||
stage: post_deployment
|
||||
stage: post_deployment/6000
|
||||
type: shell
|
||||
parameters:
|
||||
cmd: ./compute_post_deployment.py
|
||||
timeout: 42
|
||||
# Task is applied for all roles
|
||||
- role: '*'
|
||||
stage: pre_deployment
|
||||
type: shell
|
||||
parameters:
|
||||
cmd: echo all > /tmp/plugin.all
|
||||
timeout: 42
|
||||
# "reboot" task reboots the nodes and waits until they get back online
|
||||
# - role: '*'
|
||||
# stage: pre_deployment
|
||||
# type: reboot
|
||||
# parameters:
|
||||
# timeout: 600
|
||||
timeout: 60
|
||||
|
|
Loading…
Reference in New Issue