Merge "Remove run-playbooks"
This commit is contained in:
commit
074b51b168
@ -183,8 +183,9 @@ following:
|
||||
|
||||
.. code-block:: shell-session
|
||||
|
||||
cp etc/openstack_deploy/conf.d/{aodh,gnocchi,ceilometer}.yml.aio /etc/openstack_deploy/conf.d/
|
||||
for f in $(ls -1 /etc/openstack_deploy/conf.d/*.aio); do mv -v ${f} ${f%.*}; done
|
||||
# cd /opt/openstack-ansible/playbooks
|
||||
# cp etc/openstack_deploy/conf.d/{aodh,gnocchi,ceilometer}.yml.aio /etc/openstack_deploy/conf.d/
|
||||
# for f in $(ls -1 /etc/openstack_deploy/conf.d/*.aio); do mv -v ${f} ${f%.*}; done
|
||||
|
||||
To add any global overrides, over and above the defaults for the applicable
|
||||
scenario, edit ``/etc/openstack_deploy/user_variables.yml``. See the
|
||||
@ -194,17 +195,10 @@ Finally, run the playbooks by executing:
|
||||
|
||||
.. code-block:: shell-session
|
||||
|
||||
# scripts/run-playbooks.sh
|
||||
|
||||
.. note::
|
||||
Do not execute the ``run-playbooks.sh`` more than once. If something goes
|
||||
wrong, it is necessary to start over as described below in the
|
||||
`Rebuilding an AIO`_ section. Alternatively, it may be possible to
|
||||
individually run each playbook rather than starting over. If any playbooks
|
||||
need to be re-run after the initial deploy, they should be run from the
|
||||
playbooks directory with the openstack-ansible command. Executing
|
||||
``run-playbooks.sh`` a second time results in an inconsistent state for LXC
|
||||
IPtables rules and causes network connectivity issues from within containers.
|
||||
# cd /opt/openstack-ansible/playbooks
|
||||
# openstack-ansible setup-hosts.yml
|
||||
# openstack-ansible setup-infrastructure.yml
|
||||
# openstack-ansible setup-openstack.yml
|
||||
|
||||
The installation process will take a while to complete, but here are some
|
||||
general estimates:
|
||||
@ -223,10 +217,6 @@ Keystone service, execute:
|
||||
# cd /opt/openstack-ansible/playbooks
|
||||
# openstack-ansible os-keystone-install.yml
|
||||
|
||||
**Note:** The AIO bootstrap playbook will still build containers for services
|
||||
that are not requested for deployment, but the service will not be deployed
|
||||
in that container.
|
||||
|
||||
.. _bootstrap-aio default services: https://git.openstack.org/cgit/openstack/openstack-ansible/tree/tests/bootstrap-aio.yml
|
||||
|
||||
Rebooting an AIO
|
||||
|
@ -62,26 +62,6 @@ configured using environment variables - more details are provided on the
|
||||
Development and Testing
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
run-playbooks.sh
|
||||
----------------
|
||||
|
||||
The ``run-playbooks`` script is designed to be executed in development and
|
||||
test environments and is also used for automated testing. It executes actions
|
||||
which are definitely **not** suitable for production environments and must
|
||||
therefore **not** be used for that purpose.
|
||||
|
||||
The default MaxSessions setting for the OpenSSH Daemon is 10. Each Ansible
|
||||
fork makes use of a Session. By default Ansible sets the number of forks to 5,
|
||||
but the ``run-playbooks.sh`` script sets the number of forks used based on the
|
||||
number of CPU's on the deployment host up to a maximum of 10.
|
||||
|
||||
If a developer wishes to increase the number of forks used when using this
|
||||
script, override the ANSIBLE_FORKS environment variable. For example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
export ANSIBLE_FORKS=20
|
||||
|
||||
Lint Tests
|
||||
----------
|
||||
|
||||
|
@ -44,6 +44,9 @@ export OSA_CLONE_DIR="$(readlink -f $(dirname ${0})/..)"
|
||||
# with the Ansible galaxy API.
|
||||
export ANSIBLE_ROLE_FETCH_MODE="git-clone"
|
||||
|
||||
# The directory in which the ansible logs will be placed
|
||||
export ANSIBLE_LOG_DIR="/openstack/log/ansible-logging"
|
||||
|
||||
# Set the scenario to execute based on the first CLI parameter
|
||||
export SCENARIO=${1:-"aio"}
|
||||
|
||||
@ -155,20 +158,45 @@ pushd "${OSA_CLONE_DIR}/playbooks"
|
||||
# Disable Ansible color output
|
||||
export ANSIBLE_NOCOLOR=1
|
||||
|
||||
# Create ansible logging directory and add in a log file export
|
||||
mkdir -p /openstack/log/ansible-logging
|
||||
export ANSIBLE_LOG_PATH="/openstack/log/ansible-logging/ansible.log"
|
||||
# Create ansible logging directory
|
||||
mkdir -p ${ANSIBLE_LOG_DIR}
|
||||
|
||||
# Log some data about the instance and the rest of the system
|
||||
log_instance_info
|
||||
|
||||
# First we gather facts about the hosts to populate the fact cache.
|
||||
# We can't gather the facts for all hosts yet because the containers
|
||||
# aren't built yet.
|
||||
ansible -m setup -a 'gather_subset=network,hardware,virtual' hosts 2>${ANSIBLE_LOG_DIR}/facts-hosts.log
|
||||
|
||||
# Prepare the hosts
|
||||
export ANSIBLE_LOG_PATH="${ANSIBLE_LOG_DIR}/setup-hosts.log"
|
||||
openstack-ansible setup-hosts.yml -e gather_facts=False
|
||||
|
||||
# Log some data about the instance and the rest of the system
|
||||
log_instance_info
|
||||
|
||||
# Once setup-hosts is complete, we should gather facts for everything
|
||||
# (now including containers) so that the fact cache is complete for the
|
||||
# remainder of the run.
|
||||
ansible -m setup -a 'gather_subset=network,hardware,virtual' all 1>${ANSIBLE_LOG_DIR}/facts-all.log
|
||||
|
||||
# Prepare the infrastructure
|
||||
export ANSIBLE_LOG_PATH="${ANSIBLE_LOG_DIR}/setup-infrastructure.log"
|
||||
openstack-ansible setup-infrastructure.yml -e gather_facts=False
|
||||
|
||||
# Log some data about the instance and the rest of the system
|
||||
log_instance_info
|
||||
|
||||
# Setup OpenStack
|
||||
export ANSIBLE_LOG_PATH="${ANSIBLE_LOG_DIR}/setup-openstack.log"
|
||||
openstack-ansible setup-openstack.yml -e gather_facts=False
|
||||
|
||||
# Log some data about the instance and the rest of the system
|
||||
log_instance_info
|
||||
|
||||
popd
|
||||
|
||||
# Log some data about the instance and the rest of the system
|
||||
log_instance_info
|
||||
|
||||
# Execute the Playbooks
|
||||
bash "${OSA_CLONE_DIR}/scripts/run-playbooks.sh"
|
||||
|
||||
# Log some data about the instance and the rest of the system
|
||||
log_instance_info
|
||||
|
||||
# If the action is to upgrade, then checkout the original SHA for
|
||||
# the checkout, and execute the upgrade.
|
||||
if [[ "${ACTION}" == "upgrade" ]]; then
|
||||
|
@ -1,132 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2014, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
## Shell Opts ----------------------------------------------------------------
|
||||
set -e -u
|
||||
|
||||
## Variables -----------------------------------------------------------------
|
||||
PLAYBOOK_LOGS=${PLAYBOOK_LOGS:-"/openstack/log/ansible_playbooks/"}
|
||||
COMMAND_LOGS=${COMMAND_LOGS:-"/openstack/log/ansible_cmd_logs/"}
|
||||
ORIG_ANSIBLE_LOG_PATH=${ANSIBLE_LOG_PATH:-"/openstack/log/ansible-logging/ansible.log"}
|
||||
|
||||
## Main ----------------------------------------------------------------------
|
||||
function run_play_book_exit_message {
|
||||
echo -e "\e[1;5;97m*** NOTICE ***\e[0m
|
||||
|
||||
The \"\e[1;31m${0}\e[0m\" script has exited. This script is no longer needed from now on.
|
||||
If you need to re-run parts of the stack, adding new nodes to the environment,
|
||||
or have encountered an error you will no longer need this application to
|
||||
interact with the environment. All jobs should be executed out of the
|
||||
\"\e[1;33m${PLAYBOOK_DIR}\e[0m\" directory using the \"\e[1;32mopenstack-ansible\e[0m\"
|
||||
command line wrapper.
|
||||
|
||||
For more information about OpenStack-Ansible please review our documentation at:
|
||||
\e[1;36mhttp://docs.openstack.org/developer/openstack-ansible\e[0m
|
||||
|
||||
Additionally if there's ever a need for information on common operational tasks please
|
||||
see the following information:
|
||||
\e[1;36mhttp://docs.openstack.org/developer/openstack-ansible/developer-docs/ops.html\e[0m
|
||||
|
||||
|
||||
If you ever have any questions please join the community conversation on IRC at
|
||||
#openstack-ansible on freenode.
|
||||
"
|
||||
}
|
||||
|
||||
function get_includes {
|
||||
/opt/ansible-runtime/bin/python <<EOC
|
||||
import yaml
|
||||
with open("${1}") as f:
|
||||
yaml_list = yaml.safe_load(f.read())
|
||||
for item in yaml_list:
|
||||
_item = '---\n' + yaml.safe_dump([item], default_flow_style=False, width=1000)
|
||||
print(repr(_item).strip("'").strip('"'))
|
||||
EOC
|
||||
}
|
||||
|
||||
function get_include_file {
|
||||
/opt/ansible-runtime/bin/python <<EOC
|
||||
import yaml
|
||||
with open("${1}") as f:
|
||||
yaml_list = yaml.safe_load(f.read())
|
||||
print(yaml_list[0]['include'])
|
||||
EOC
|
||||
}
|
||||
|
||||
function playbook_run {
|
||||
|
||||
# First we gather facts about the hosts to populate the fact cache.
|
||||
# We can't gather the facts for all hosts yet because the containers
|
||||
# aren't built yet.
|
||||
ansible -m setup -a "gather_subset=network,hardware,virtual" hosts
|
||||
|
||||
# Iterate over lines in setup-everything
|
||||
IFS=$'\n'
|
||||
COUNTER=0
|
||||
for root_include in $(get_includes setup-everything.yml); do
|
||||
echo -e "${root_include}" > root-include-playbook.yml
|
||||
root_include_file_name="$(get_include_file root-include-playbook.yml)"
|
||||
|
||||
# Once setup-hosts is complete, we should gather facts for everything
|
||||
# (now including containers) so that the fact cache is complete for the
|
||||
# remainder of the run.
|
||||
if [[ "${root_include_file_name}" == "setup-infrastructure.yml" ]]; then
|
||||
ansible -m setup -a "gather_subset=network,hardware,virtual" all
|
||||
fi
|
||||
for include in $(get_includes "${root_include_file_name}"); do
|
||||
echo -e "${include}" > /tmp/include-playbook.yml
|
||||
include_file_name="$(get_include_file /tmp/include-playbook.yml)"
|
||||
include_playbook="include-playbook.yml-${include_file_name}"
|
||||
mv /tmp/include-playbook.yml ${include_playbook}
|
||||
echo "[Executing \"${include_file_name}\" playbook]"
|
||||
# Set the playbook log path so that we can review specific execution later.
|
||||
export ANSIBLE_LOG_PATH="${PLAYBOOK_LOGS}/${COUNTER}-${include_file_name}.txt"
|
||||
let COUNTER=COUNTER+=1
|
||||
install_bits "${include_playbook}"
|
||||
# Remove the generate playbook when done with it
|
||||
rm "${include_playbook}"
|
||||
done
|
||||
# Remove the generate playbook when done with it
|
||||
rm root-include-playbook.yml
|
||||
done
|
||||
cat ${PLAYBOOK_LOGS}/* >> "${ORIG_ANSIBLE_LOG_PATH}"
|
||||
}
|
||||
|
||||
trap run_play_book_exit_message EXIT
|
||||
|
||||
info_block "Checking for required libraries." 2> /dev/null || source "$(dirname "${0}")/scripts-library.sh"
|
||||
|
||||
# Initiate the deployment
|
||||
pushd "playbooks"
|
||||
PLAYBOOK_DIR="$(pwd)"
|
||||
|
||||
# Create playbook log directory
|
||||
mkdir -p "${PLAYBOOK_LOGS}"
|
||||
mkdir -p "$(dirname ${ORIG_ANSIBLE_LOG_PATH})"
|
||||
|
||||
# Execute setup everything
|
||||
playbook_run
|
||||
|
||||
# Log some data about the instance and the rest of the system
|
||||
log_instance_info
|
||||
|
||||
# Log repo data
|
||||
mkdir -p "${COMMAND_LOGS}/repo_data"
|
||||
ansible 'repo_all[0]' -m raw \
|
||||
-a 'find /var/www/repo/os-releases -type l' \
|
||||
-t "${COMMAND_LOGS}/repo_data"
|
||||
|
||||
print_report
|
||||
popd
|
@ -18,7 +18,7 @@
|
||||
## Vars ----------------------------------------------------------------------
|
||||
LINE='----------------------------------------------------------------------'
|
||||
MAX_RETRIES=${MAX_RETRIES:-5}
|
||||
ANSIBLE_PARAMETERS=${ANSIBLE_PARAMETERS:--e gather_facts=False}
|
||||
ANSIBLE_PARAMETERS=${ANSIBLE_PARAMETERS:-""}
|
||||
STARTTIME="${STARTTIME:-$(date +%s)}"
|
||||
PIP_INSTALL_OPTIONS=${PIP_INSTALL_OPTIONS:-'pip==9.0.1 setuptools==36.2.0 wheel==0.29.0 '}
|
||||
COMMAND_LOGS=${COMMAND_LOGS:-"/openstack/log/ansible_cmd_logs"}
|
||||
@ -50,41 +50,6 @@ function determine_distro {
|
||||
export DISTRO_VERSION_ID="${VERSION_ID}"
|
||||
}
|
||||
|
||||
# Used to retry a process that may fail due to random issues.
|
||||
function successerator {
|
||||
set +e
|
||||
# Get the time that the method was started.
|
||||
OP_START_TIME=$(date +%s)
|
||||
# Set the initial return value to failure.
|
||||
false
|
||||
for ((RETRY=0; $? != 0 && RETRY < MAX_RETRIES; RETRY++)); do
|
||||
if [ ${RETRY} -gt 1 ];then
|
||||
"$@" -vvvv
|
||||
else
|
||||
"$@"
|
||||
fi
|
||||
done
|
||||
# If max retires were hit, fail.
|
||||
if [ $? -ne 0 ] && [ ${RETRY} -eq ${MAX_RETRIES} ];then
|
||||
echo -e "\nHit maximum number of retries, giving up...\n"
|
||||
exit_fail
|
||||
fi
|
||||
# Ensure the log directory exists
|
||||
if [[ ! -d "${COMMAND_LOGS}" ]];then
|
||||
mkdir -p "${COMMAND_LOGS}"
|
||||
fi
|
||||
# Log the time that the method completed.
|
||||
OP_TOTAL_SECONDS="$(( $(date +%s) - OP_START_TIME ))"
|
||||
echo -e "- Operation: [ $@ ]\t${OP_TOTAL_SECONDS} seconds\tNumber of Attempts [ ${RETRY} ]" \
|
||||
>> ${COMMAND_LOGS}/ansible_runtime_report.txt
|
||||
set -e
|
||||
}
|
||||
|
||||
function install_bits {
|
||||
# Use the successerator to run openstack-ansible
|
||||
successerator openstack-ansible "$@" ${ANSIBLE_PARAMETERS}
|
||||
}
|
||||
|
||||
function ssh_key_create {
|
||||
# Ensure that the ssh key exists and is an authorized_key
|
||||
key_path="${HOME}/.ssh"
|
||||
@ -229,11 +194,6 @@ function get_instance_info {
|
||||
esac
|
||||
}
|
||||
|
||||
function print_report {
|
||||
# Print the stored report data
|
||||
cat ${COMMAND_LOGS}/ansible_runtime_report.txt
|
||||
}
|
||||
|
||||
function get_pip {
|
||||
|
||||
# check if pip is already installed
|
||||
|
Loading…
x
Reference in New Issue
Block a user