Skip to content
Snippets Groups Projects
Commit 63ab5319 authored by Dincer Celik's avatar Dincer Celik
Browse files

Adds maximum supported version check for Ansible

Maximum supported version is set to 2.9

Updated the minimum supported version to 2.8

Implements: blueprint ansible-max-version

Change-Id: I97cc95e37f49886e6d74f2d5a789b923b14b5a2d
parent da105c20
No related branches found
No related tags found
No related merge requests found
...@@ -6,8 +6,13 @@ ...@@ -6,8 +6,13 @@
when: inventory_hostname in groups['baremetal'] when: inventory_hostname in groups['baremetal']
failed_when: result is failed or result.stdout is version(docker_py_version_min, '<') 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 - name: Checking Ansible version
vars:
ansible_version_host: "{{ ansible_version.major }}.{{ ansible_version.minor }}"
fail: 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 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, '>')
--- ---
docker_version_min: '1.10.0' docker_version_min: '1.10.0'
docker_py_version_min: '2.0.0' docker_py_version_min: '2.0.0'
ansible_version_min: '2.6.0' ansible_version_min: '2.8'
ansible_version_max: '2.9'
...@@ -89,8 +89,8 @@ If not installing Kolla Ansible in a virtual environment, skip this section. ...@@ -89,8 +89,8 @@ If not installing Kolla Ansible in a virtual environment, skip this section.
pip install -U pip pip install -U pip
#. Install `Ansible <http://www.ansible.com>`__. Currently, Kolla Ansible #. Install `Ansible <http://www.ansible.com>`__. Kolla Ansible requires at least
requires Ansible 2.6+. Ansible ``2.8`` and supports up to ``2.9``.
.. code-block:: console .. code-block:: console
...@@ -121,8 +121,8 @@ If installing Kolla Ansible in a virtual environment, skip this section. ...@@ -121,8 +121,8 @@ If installing Kolla Ansible in a virtual environment, skip this section.
sudo pip install -U pip sudo pip install -U pip
#. Install `Ansible <http://www.ansible.com>`__. Currently, Kolla Ansible #. Install `Ansible <http://www.ansible.com>`__. Kolla Ansible requires at least
requires Ansible 2.6+. Ansible ``2.8`` and supports up to ``2.9``.
For CentOS or RHEL, run: For CentOS or RHEL, run:
......
---
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.
...@@ -148,7 +148,7 @@ ...@@ -148,7 +148,7 @@
- name: install kolla-ansible and dependencies - name: install kolla-ansible and dependencies
vars: vars:
# Test latest ansible version on Ubuntu, minimum supported on others. # 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: pip:
name: name:
- "{{ kolla_ansible_src_dir }}" - "{{ kolla_ansible_src_dir }}"
...@@ -373,7 +373,7 @@ ...@@ -373,7 +373,7 @@
- name: install ansible and ARA for python 3 - name: install ansible and ARA for python 3
vars: vars:
# Test latest ansible version on Ubuntu, minimum supported on others. # 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: pip:
name: name:
- "ansible{{ ansible_version_constraint }}" - "ansible{{ ansible_version_constraint }}"
......
...@@ -2,6 +2,18 @@ ...@@ -2,6 +2,18 @@
# #
# This script can be used to interact with kolla via ansible. # 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 { function find_base_dir {
# $1: Python interpreter # $1: Python interpreter
local python local python
...@@ -117,6 +129,8 @@ genconfig ...@@ -117,6 +129,8 @@ genconfig
EOF EOF
} }
check_ansible_compatibility
SHORT_OPTS="hi:p:t:k:e:v" 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" 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"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment