Custom scripts added.
Change-Id: Ic9be20ff5e4b04c3fbebdbc3b007ebe14a4b4561
This commit is contained in:
parent
bdd816cc09
commit
f953d9d803
|
@ -0,0 +1,65 @@
|
|||
#!/bin/bash
|
||||
|
||||
#set -o xtrace
|
||||
set -o errexit
|
||||
|
||||
source ./functions.sh
|
||||
source ./local.rc
|
||||
|
||||
|
||||
title "Configuring Compute Nodes"
|
||||
for node_name in $COMPUTE_NODE_LIST ; do
|
||||
ssh_script $node_name configure-nwfilter.sh
|
||||
ssh_script $node_name configure-ramdrive.sh
|
||||
done
|
||||
|
||||
for node_name in $METADATA_NODE_LIST ; do
|
||||
ssh_script $node_name configure-metadata.sh
|
||||
done
|
||||
|
||||
title "Configuring RabbitMQ Nodes"
|
||||
for node_name in $RABBITMQ_NODE_LIST ; do
|
||||
ssh_script $node_name configure-rabbitmq.sh -b \
|
||||
$RABBITMQ_LOGIN $RABBITMQ_PASSWORD $RABBITMQ_VHOST
|
||||
done
|
||||
|
||||
|
||||
rm -rf /opt/openstack | true
|
||||
mkdir -p /opt/openstack/ssl | true
|
||||
|
||||
|
||||
if [ -n "$PUPPET_HOST" ] ; then
|
||||
title "Getting Windows Image"
|
||||
scp root@$PUPPET_HOST:/home/murano/ws-2012-std.qcow2 /opt/openstack
|
||||
[ -f /opt/openstack/ws-2012-std.qcow2 ] || \
|
||||
die "Image '/opt/openstack/ws-2012-std.qcow2' not found."
|
||||
|
||||
title "Getting SSL Certificates"
|
||||
scp root@$PUPPET_HOST:/etc/puppet/files/openstack_ssl/* /opt/openstack/ssl
|
||||
[ -f /opt/openstack/ssl/cacert.pem ] || \
|
||||
die "Image '/opt/openstack/ssl/cacert.pem' not found."
|
||||
|
||||
title "Getting OpenStack Credential File"
|
||||
scp root@$PUPPET_HOST:/home/murano/openrc /opt/openstack
|
||||
[ -f /opt/openstack/openrc ] || \
|
||||
die "Image '/opt/openstack/openrc' not found."
|
||||
|
||||
source /opt/openstack/openrc set
|
||||
|
||||
title "Getting List of Images From Glance"
|
||||
glance --insecure image-list
|
||||
|
||||
title "Removing Windows Image"
|
||||
glance --insecure image-delete ws-2012-std | true
|
||||
echo 'Done.'
|
||||
|
||||
title "Adding New Image Into Glance"
|
||||
echo 'This might take a few minutes ...'
|
||||
glance --insecure image-create \
|
||||
--name ws-2012-std \
|
||||
--disk-format qcow2 \
|
||||
--container-format bare \
|
||||
--file /opt/openstack/ws-2012-std.qcow2 \
|
||||
--is-public true \
|
||||
--property murano_image_info='{"type":"ws-2012-std","title":"Windows Server 2012 Standard"}'
|
||||
fi
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
sed -i 's/^enabled_ssl_apis/#enabled_ssl_apis/' /etc/nova/nova.conf
|
||||
service nova-api restart
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo ''
|
||||
echo 'Getting nwfilter rules'
|
||||
virsh nwfilter-dumpxml nova-base > /root/nova-base.xml.bak
|
||||
|
||||
echo ''
|
||||
echo 'Updating rule definitions'
|
||||
cat /root/nova-base.xml.bak | grep -v spoofing > /tmp/nova-base.xml
|
||||
|
||||
echo ''
|
||||
echo 'Updating rules'
|
||||
virsh nwfilter-define /tmp/nova-base.xml
|
||||
|
||||
rm /tmp/nova-base.xml
|
|
@ -0,0 +1,101 @@
|
|||
#!/bin/bash
|
||||
|
||||
function show_usage {
|
||||
cat << EOF
|
||||
|
||||
Usage:
|
||||
./configure-rabbitmq.sh [-b] <user> <password> <vhost>
|
||||
|
||||
Parameters:
|
||||
-b - batch mode
|
||||
user - RabbitMQ user name
|
||||
password - RabbitMQ password
|
||||
vhost - RabbitMQ vHost
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
batch_mode='false'
|
||||
case $1 in
|
||||
''|'-h')
|
||||
show_usage
|
||||
exit
|
||||
;;
|
||||
'-b')
|
||||
batch_mode='true'
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
|
||||
rabbitmq_user=$1
|
||||
rabbitmq_password=$2
|
||||
rabbitmq_vhost=$3
|
||||
|
||||
if [ "$batch_mode" = 'false' ]; then
|
||||
cat << EOF
|
||||
|
||||
You've requested the following configuration:
|
||||
* RabbitMQ User '$rabbitmq_user' with password '$rabbitmq_password'
|
||||
* RabbitMQ vHost '$rabbitmq_vhost'
|
||||
|
||||
Please confirm that it is what you want.
|
||||
|
||||
EOF
|
||||
|
||||
confirmtion=''
|
||||
while [ "$confirmation" = '' ] ; do
|
||||
read -p "Please type 'yes' to proceed or 'quit' for exit: " confirmation
|
||||
case $confirmation in
|
||||
'yes')
|
||||
echo ''
|
||||
echo "Continuing ..."
|
||||
break
|
||||
;;
|
||||
'quit')
|
||||
echo ''
|
||||
echo "Exiting..."
|
||||
exit
|
||||
;;
|
||||
*)
|
||||
confirmation=''
|
||||
echo ''
|
||||
echo "Wrong data entered, please try again."
|
||||
echo ''
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
#echo "Deleting user '$rabbitmq_user' ..."
|
||||
echo ''
|
||||
rabbitmqctl delete_user $rabbitmq_user
|
||||
sleep 2
|
||||
|
||||
#echo "Deleting vHost '$rabbitmq_vhost' ..."
|
||||
echo ''
|
||||
rabbitmqctl delete_vhost $rabbitmq_vhost
|
||||
sleep 2
|
||||
|
||||
#echo "Creating user '$rabbitmq_user' ..."
|
||||
echo ''
|
||||
rabbitmqctl add_user $rabbitmq_user $rabbitmq_password
|
||||
sleep 2
|
||||
|
||||
#echo "Updating user tags ..."
|
||||
echo ''
|
||||
rabbitmqctl set_user_tags $rabbitmq_user administrator
|
||||
sleep 2
|
||||
|
||||
#echo "Creating vHost '$rabbitmq_vhost' ..."
|
||||
echo ''
|
||||
rabbitmqctl add_vhost $rabbitmq_vhost
|
||||
sleep 2
|
||||
|
||||
#echo "Assigning permissions ..."
|
||||
echo ''
|
||||
rabbitmqctl set_permissions -p $rabbitmq_vhost $rabbitmq_user ".*" ".*" ".*"
|
||||
sleep 2
|
||||
|
||||
echo ''
|
||||
echo "RabbitMQ Configuration Completed."
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
#!/bin/bash
|
||||
|
||||
target_dir=${1:-'/var/lib/nova/instances'}
|
||||
tmpfs_size=${2:-160G}
|
||||
|
||||
|
||||
echo ''
|
||||
echo 'Removing running instances'
|
||||
|
||||
for name in $(virsh list --name) ; do
|
||||
echo ''
|
||||
echo "Destroying instance '$name' ..."
|
||||
virsh destroy --domain $name
|
||||
done
|
||||
|
||||
parent_dir=$(dirname "$target_dir")
|
||||
child_dir=$(basename "$target_dir")
|
||||
|
||||
old_pwd=$(pwd)
|
||||
|
||||
if [ -z "$(mount | grep $target_dir)" ] ; then
|
||||
echo ''
|
||||
echo "Preparing to mount tmpfs to '$target_dir' ..."
|
||||
|
||||
cd $parent_dir
|
||||
|
||||
echo ''
|
||||
echo "Removing cached images from '$target_dir/_base/' ..."
|
||||
rm -f $target_dir/_base/*
|
||||
|
||||
if [ -f "$child_dir.tar.gz" ] ; then
|
||||
rm -f "$child_dir.tar.gz"
|
||||
fi
|
||||
|
||||
tar czvf "$child_dir.tar.gz" "$child_dir"
|
||||
|
||||
mount -t tmpfs -o size=$tmpfs_size tmpfs "$target_dir"
|
||||
|
||||
tar xzvf "$child_dir.tar.gz"
|
||||
else
|
||||
echo ''
|
||||
echo "'$target_dir' already mounted."
|
||||
fi
|
||||
|
||||
cd $old_pwd
|
|
@ -0,0 +1,103 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -o errexit
|
||||
|
||||
source ./functions.sh
|
||||
|
||||
|
||||
title "Adding Mirantis Repositories"
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
wget http://download.mirantis.com/precise-fuel-grizzly/Mirantis.key -O /tmp/Mirantis.key
|
||||
apt-key add /tmp/Mirantis.key
|
||||
rm /tmp/Mirantis.key
|
||||
|
||||
cat << EOF > /etc/apt/sources.list.d/mirantis-releases.list
|
||||
# mirantis-releases
|
||||
deb http://download.mirantis.com/precise-fuel-grizzly precise main
|
||||
EOF
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
wget http://intel-repo.mirantis.com/ubuntu/gpg.pub -O /tmp/gpg.pub
|
||||
apt-key add /tmp/gpg.pub
|
||||
rm /tmp/gpg.pub
|
||||
|
||||
cat << EOF > /etc/apt/sources.list.d/intel-cloud-stable.list
|
||||
# intel-cloud-stable
|
||||
deb http://intel-repo.mirantis.com/ubuntu/stable precise main
|
||||
EOF
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
echo 'Done'
|
||||
|
||||
|
||||
|
||||
title "Adding 'archive.gplhost.com' Repository"
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
cat << EOF > /etc/apt/sources.list.d/gplhost-archive.list
|
||||
deb http://archive.gplhost.com/debian grizzly main
|
||||
deb http://archive.gplhost.com/debian grizzly-backports main
|
||||
EOF
|
||||
|
||||
apt-get --quiet=2 --yes update
|
||||
|
||||
apt-get install --quiet=2 --yes --force-yes gplhost-archive-keyring
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
echo 'Done'
|
||||
|
||||
|
||||
|
||||
title "Configuring Package Pinning Preferences"
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
cat << EOF > /etc/apt/preferences.d/intel-cloud-stable.pref
|
||||
# intel-cloud-stable
|
||||
Package: *
|
||||
Pin: release o=OpenStack CI
|
||||
Pin-Priority: 560
|
||||
EOF
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
cat << EOF > /etc/apt/preferences.d/mirantis-releases.pref
|
||||
# mirantis-releases
|
||||
Package: *
|
||||
Pin: release o=Mirantis
|
||||
Pin-Priority: 530
|
||||
EOF
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
cat << EOF > /etc/apt/preferences.d/ubuntu-packages.pref
|
||||
Package: *
|
||||
Pin: release o=Ubuntu
|
||||
Pin-Priority: 501
|
||||
EOF
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
echo 'Done'
|
||||
|
||||
|
||||
|
||||
title "Updating Package Information"
|
||||
|
||||
apt-get --quiet=2 --yes update
|
||||
|
||||
echo 'Done'
|
||||
|
||||
|
||||
|
||||
title "Upgrading System"
|
||||
|
||||
apt-get --quiet=2 --yes upgrade
|
||||
|
||||
echo 'Done'
|
|
@ -0,0 +1,45 @@
|
|||
#!/bin/bash
|
||||
|
||||
function die {
|
||||
cat << EOF
|
||||
|
||||
Script Failed
|
||||
***** ***** ***** ***** ***** *****
|
||||
$@
|
||||
***** ***** ***** ***** ***** *****
|
||||
EOF
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
|
||||
function title {
|
||||
cat << EOF
|
||||
|
||||
|
||||
$@
|
||||
=================================================
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
function info {
|
||||
cat << EOF
|
||||
|
||||
[INFO] $@
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
function ssh_script {
|
||||
local remote_host=$1
|
||||
local script_path=$2
|
||||
shift 2
|
||||
|
||||
local script_name=$(basename $script_path)
|
||||
|
||||
scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=quiet \
|
||||
$script_path $remote_host:/tmp/$script_name.tmp
|
||||
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=quiet \
|
||||
$remote_host bash /tmp/$script_name.tmp "$@"
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
source /etc/murano-deployment/lab-binding.rc
|
||||
|
||||
RABBITMQ_NODE_LIST=''
|
||||
|
||||
COMPUTE_NODE_LIST=''
|
||||
|
||||
METADATA_NODE_LIST=''
|
||||
|
||||
PUPPET_HOST=''
|
Loading…
Reference in New Issue