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
6 changes: 6 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ To configure OpenStack infrastructure:

$ tools/openstack-config

Optionally provide environment name if using multiple environments:

.. code-block::

$ 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