Openstack All In One Ansible Install

by jbthechamp83
8 deployments · 2 still active · last rev. 1 year ago

Install openstack ansible conveniently using this awesome script by openstack - all in one

Compatible with: Debian 8
						#!/usr/bin/env bash
#
# StackScript Bash Library
#
# Copyright (c) 2015 Jurisdesk LLC / James Barlow <james@jurisdesk.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright notice, this
# list of conditions and the following disclaimer in the documentation and/or
# other materials provided with the distribution.
#
# * Neither the name of Jurisdesk LLC nor the names of its contributors may be
# used to endorse or promote products derived from this software without specific prior
# written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
# SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
# DAMAGE.
#
# Openstack All In One Ansible Installer
# Copyright (c) 2015 James Barlow <james@dockerd.io>.
#
# My ref: https://www.linode.com/?r=6bc13d37a6384afa18b7ba182e355e40a12e10c0

apt-get install -y build-essential fakeroot python-pip curl git-core

## Shell Opts ----------------------------------------------------------------

set -e -u +x

## Variables -----------------------------------------------------------------

export REPO_URL=${REPO_URL:-"https://github.com/jurisdesk/openstack-ansible.git"}
export REPO_BRANCH=${REPO_BRANCH:-"master"}
export WORKING_FOLDER=${WORKING_FOLDER:-"/opt/openstack-ansible"}

## Main ----------------------------------------------------------------------

# set verbosity
set -x

# install git so that we can fetch the repo
# note: the redirect of stdin to /dev/null is necessary for when this script is
# run as part of a curl-pipe-shell. otherwise apt-get will consume the rest of
# this file as if it was its own stdin (despite using -y to skip interaction).
apt-get update && apt-get install -y git < /dev/null

# fetch the repo
git clone -b ${REPO_BRANCH} ${REPO_URL} ${WORKING_FOLDER}

# change into the expected root directory
cd ${WORKING_FOLDER}

# first, bootstrap the AIO host
source scripts/bootstrap-aio.sh

# next, bootstrap Ansible
source scripts/bootstrap-ansible.sh

# finally, run all the playbooks
bash scripts/run-playbooks.sh

# put a motd in place to help the user know what stuff is accessible once the build is complete
cat > /etc/update-motd.d/20-openstack<< EOF
#!/usr/bin/env bash
echo ""
echo "############ openstack-ansible all-in-one build #############"
echo ""
echo " OpenStack Services are now listening on $(ip -o -4 addr show dev eth0 | awk -F '[ /]+' '/global/ {print $4}')"
echo ""
EOF
chmod +x /etc/update-motd.d/20-openstack

# put an motd in place to help the user know how to restart galera after reboot
cat > /etc/update-motd.d/21-galera<< EOF
#!/usr/bin/env bash
echo ""
echo "If this server has been rebooted, you will need to re-bootstrap"
echo "Galera to get the cluster operational. To do this execute:"
echo ""
echo "This requires you to identify the most advanced node. For details see http://galeracluster.com/documentation-webpages/quorumreset.html
echo ""
EOF
chmod +x /etc/update-motd.d/21-galera