Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ To configure OpenStack infrastructure:

$ tools/openstack-config

Support for Kayobe multiple environments is provided using environment name switch and appending '-environment_name' to the config file:

.. code-block::

$ ls ./etc/openstack-config/openstack-config-<environment name>.yml
$ tools/openstack-config -e <environment name>

To run a specific playbook:

.. code-block::
Expand Down
21 changes: 10 additions & 11 deletions tools/openstack-config
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,30 @@ cd ${OPENSTACK_CONFIG_PATH}

PLAYBOOK=ansible/openstack.yml

while getopts ":p:" opt; do
while getopts ":p:e:" opt; do
case $opt in
p)
PLAYBOOK=${OPTARG}
;;

e)
ENV="-${OPTARG}"
;;
\?)
echo "Invalid option: -$opt"
echo "Usage: ${0} [-p <playbook>] [-- <other arguments to ansible-playbook>]"
echo "Invalid option: -$OPTARG"
echo "Usage: ${0} [-p <playbook>] [-e <kayobe environment name>] [-- <other arguments to ansible-playbook>]"
exit 1
;;
esac
if [[ -n ${OPTARG} ]]; then
shift
fi
shift
done

if [[ $1 == '--' ]]; then
shift
fi
# Removing parameters already parsed with getopts
shift $(( OPTIND - 1 ))

echo "Running playbook $PLAYBOOK"

exec ansible-playbook \
${PLAYBOOK} \
-i ansible/inventory \
-e @etc/openstack-config/openstack-config.yml \
-e @etc/openstack-config/openstack-config${ENV}.yml \
$@
Loading