diff --git a/inventory/group_vars/all/all.yml b/inventory/group_vars/all/all.yml index 335f654d23..57e316324b 100644 --- a/inventory/group_vars/all/all.yml +++ b/inventory/group_vars/all/all.yml @@ -14,7 +14,7 @@ # limitations under the License. ## OpenStack Source Code Release -openstack_release: 17.1.8 +openstack_release: "{{ lookup('env', 'OSA_VERSION') | default('undefined', true) }}" ## Verbosity Options debug: False diff --git a/scripts/bootstrap-ansible.sh b/scripts/bootstrap-ansible.sh index ca0bd8b0b8..7dbac246a0 100755 --- a/scripts/bootstrap-ansible.sh +++ b/scripts/bootstrap-ansible.sh @@ -173,6 +173,9 @@ PIP_OPTS+=" --constraint ${UPPER_CONSTRAINTS_FILE}" # a different version of Ansible to the one we want to install. As such, we # use --isolated so that the config file is ignored. +# Get current code version (this runs at the root of OSA clone) +CURRENT_OSA_VERSION=$(cd ${OSA_CLONE_DIR}; /opt/ansible-runtime/bin/python setup.py --version) + # Install ansible and the other required packages ${PIP_COMMAND} install --isolated ${PIP_OPTS} -r requirements.txt ${ANSIBLE_PACKAGE} @@ -208,6 +211,8 @@ sed -i "s|OSA_PLAYBOOK_PATH|${OSA_PLAYBOOK_PATH}|g" /usr/local/bin/openstack-ans # Create openstack ansible wrapper tool cp -v ${OSA_WRAPPER_BIN} /usr/local/bin/openstack-ansible sed -i "s|OSA_CLONE_DIR|${OSA_CLONE_DIR}|g" /usr/local/bin/openstack-ansible +# Mark the current OSA version in the wrapper, so we don't need to compute it everytime. +sed -i "s|CURRENT_OSA_VERSION|${CURRENT_OSA_VERSION}|g" /usr/local/bin/openstack-ansible # Ensure wrapper tool is executable chmod +x /usr/local/bin/openstack-ansible diff --git a/scripts/openstack-ansible.sh b/scripts/openstack-ansible.sh index dd3d823a71..cbe677bd12 100644 --- a/scripts/openstack-ansible.sh +++ b/scripts/openstack-ansible.sh @@ -18,6 +18,7 @@ # OpenStack wrapper tool to ease the use of ansible with multiple variable files. export PATH="/opt/ansible-runtime/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${PATH}" +export OSA_VERSION="CURRENT_OSA_VERSION" function info { if [ "${ANSIBLE_NOCOLOR:-0}" -eq "1" ]; then