Merge "Adds maximum supported version check for Ansible"

This commit is contained in:
Zuul 2020-01-22 13:36:34 +00:00 committed by Gerrit Code Review
commit 39c09d0b60
6 changed files with 37 additions and 9 deletions

View File

@ -6,8 +6,13 @@
when: inventory_hostname in groups['baremetal']
failed_when: result is failed or result.stdout is version(docker_py_version_min, '<')
# NOTE(osmanlicilegi): ansible_version.full includes patch number that's useless
# to check. as ansible_version does not provide major.minor in dict, we need to
# set it as variable.
- name: Checking Ansible version
vars:
ansible_version_host: "{{ ansible_version.major }}.{{ ansible_version.minor }}"
fail:
msg: "Current Ansible version {{ ansible_version.full }} is less than {{ ansible_version_min }}"
msg: "Ansible version should be between {{ ansible_version_min }} and {{ ansible_version_max }}. Current version is {{ ansible_version.full }} which is not supported."
run_once: true
when: ansible_version.full is version(ansible_version_min, '<')
when: ansible_version_host is version(ansible_version_min, '<') or ansible_version_host is version(ansible_version_max, '>')

View File

@ -1,4 +1,5 @@
---
docker_version_min: '1.10.0'
docker_py_version_min: '2.0.0'
ansible_version_min: '2.6.0'
ansible_version_min: '2.8'
ansible_version_max: '2.9'

View File

@ -89,8 +89,8 @@ If not installing Kolla Ansible in a virtual environment, skip this section.
pip install -U pip
#. Install `Ansible <http://www.ansible.com>`__. Currently, Kolla Ansible
requires Ansible 2.6+.
#. Install `Ansible <http://www.ansible.com>`__. Kolla Ansible requires at least
Ansible ``2.8`` and supports up to ``2.9``.
.. code-block:: console
@ -121,8 +121,8 @@ If installing Kolla Ansible in a virtual environment, skip this section.
sudo pip install -U pip
#. Install `Ansible <http://www.ansible.com>`__. Currently, Kolla Ansible
requires Ansible 2.6+.
#. Install `Ansible <http://www.ansible.com>`__. Kolla Ansible requires at least
Ansible ``2.8`` and supports up to ``2.9``.
For CentOS or RHEL, run:

View File

@ -0,0 +1,8 @@
---
upgrade:
- |
Adds maximum supported version check for Ansible. Kolla Ansible now
requires at least Ansible ``2.8`` and supports up to ``2.9``. See
`blueprint
<https://blueprints.launchpad.net/kolla-ansible/+spec/ansible-max-version>`__
for details.

View File

@ -161,7 +161,7 @@
- name: install kolla-ansible and dependencies
vars:
# Test latest ansible version on Ubuntu, minimum supported on others.
ansible_version_constraint: "{{ '>=2.6' if base_distro == 'ubuntu' else '<2.7' }}"
ansible_version_constraint: "{{ '==2.9.*' if base_distro == 'ubuntu' else '==2.8.*' }}"
pip:
name:
- "{{ kolla_ansible_src_dir }}"
@ -413,7 +413,7 @@
- name: install ansible and ARA for python 3
vars:
# Test latest ansible version on Ubuntu, minimum supported on others.
ansible_version_constraint: "{{ '>=2.6' if base_distro == 'ubuntu' else '<2.7' }}"
ansible_version_constraint: "{{ '==2.9.*' if base_distro == 'ubuntu' else '==2.8.*' }}"
pip:
name:
- "ansible{{ ansible_version_constraint }}"

View File

@ -2,6 +2,18 @@
#
# This script can be used to interact with kolla via ansible.
function check_ansible_compatibility {
ANSIBLE_VERSION_MIN=2.8
ANSIBLE_VERSION_MAX=2.9
ANSIBLE_VERSION_HOST=$(ansible --version | head -n1 | egrep -o '[0-9]\.[0-9]+')
if [[ $(printf "%s\n" "$ANSIBLE_VERSION_MIN" "$ANSIBLE_VERSION_MAX" "$ANSIBLE_VERSION_HOST" | sort -V | head -n1) != "$ANSIBLE_VERSION_MIN" ]] ||
[[ $(printf "%s\n" "$ANSIBLE_VERSION_MIN" "$ANSIBLE_VERSION_MAX" "$ANSIBLE_VERSION_HOST" | sort -V | tail -1) != "$ANSIBLE_VERSION_MAX" ]]; then
echo "ERROR: Ansible version should be between $ANSIBLE_VERSION_MIN and $ANSIBLE_VERSION_MAX. Current version is $ANSIBLE_VERSION_HOST which is not supported."
exit 1
fi
}
function find_base_dir {
# $1: Python interpreter
local python
@ -117,6 +129,8 @@ genconfig
EOF
}
check_ansible_compatibility
SHORT_OPTS="hi:p:t:k:e:v"
LONG_OPTS="help,inventory:,playbook:,skip-tags:,tags:,key:,extra:,verbose,configdir:,passwords:,limit:,forks:,vault-id:,ask-vault-pass,vault-password-file:,yes-i-really-really-mean-it,include-images,include-dev:,full,incremental"