Bump up Ansible max supported ver to 4.x

This change bumps up max supported Ansible version
to 4.x (ansible-core 2.11.x) and minimum to 2.10.

Change-Id: I8b9212934dfab3831986e8db55671baee32f4bbd
This commit is contained in:
Michał Nasiadka 2021-06-17 08:16:11 +02:00 committed by Michal Nasiadka
parent d8641e90c3
commit 1b650534c0
7 changed files with 21 additions and 10 deletions

View File

@ -19,8 +19,11 @@ import docker
import json
import re
from ansible.module_utils.ansible_release import __version__ as ansible_version
from ansible.module_utils.basic import AnsibleModule
from ast import literal_eval
DOCUMENTATION = '''
---
module: kolla_toolbox
@ -108,7 +111,10 @@ def gen_commandline(params):
if params.get('module_name'):
command.extend(['-m', params.get('module_name')])
if params.get('module_args'):
module_args = params.get('module_args')
if StrictVersion(ansible_version) < StrictVersion('2.11.0'):
module_args = params.get('module_args')
else:
module_args = literal_eval(params.get('module_args'))
if isinstance(module_args, dict):
module_args = ' '.join("{}='{}'".format(key, value)
for key, value in module_args.items())

View File

@ -1,8 +1,8 @@
---
docker_version_min: '18.09'
docker_py_version_min: '3.4.1'
ansible_version_min: '2.9'
ansible_version_max: '2.10'
ansible_version_min: '2.10'
ansible_version_max: '2.11'
# Top level keys should match ansible_facts.distribution.
# These map to lists of supported releases (ansible_facts.distribution_release) or

View File

@ -89,11 +89,11 @@ If not installing Kolla Ansible in a virtual environment, skip this section.
pip install -U pip
#. Install `Ansible <http://www.ansible.com>`__. Kolla Ansible requires at least
Ansible ``2.9`` and supports up to ``2.10``.
Ansible ``2.10`` and supports up to ``4``.
.. code-block:: console
pip install 'ansible<3.0'
pip install 'ansible<5.0'
Install dependencies not using a virtual environment
----------------------------------------------------
@ -121,7 +121,7 @@ If installing Kolla Ansible in a virtual environment, skip this section.
sudo pip3 install -U pip
#. Install `Ansible <http://www.ansible.com>`__. Kolla Ansible requires at least
Ansible ``2.9`` and supports up to ``2.10``.
Ansible ``2.10`` and supports up to ``4``.
For CentOS or RHEL, run:

View File

@ -0,0 +1,5 @@
---
upgrade:
- |
Minimum supported Ansible version is now ``2.10`` and maximum supported
is ``4`` (ansible-core 2.11).

View File

@ -13,4 +13,4 @@ coverage!=4.4,>=4.0 # Apache-2.0
docker>=2.4.2 # Apache-2.0
oslotest>=3.2.0 # Apache-2.0
stestr>=2.0.0 # Apache-2.0
ansible>=2.9.0,<3.0 # GPLv3
ansible>=2.10.0,<5.0 # GPLv3

View File

@ -203,7 +203,7 @@
- name: install kolla-ansible and dependencies
vars:
# Test latest ansible version on Ubuntu, minimum supported on others.
ansible_version_constraint: "{{ '==2.9.*' if is_upgrade else '==2.10.*' }}"
ansible_version_constraint: "{{ '==2.10.*' if is_upgrade else '==4.*' }}"
command: >-
python3 -m pip install --user
-c {{ upper_constraints_file }}

View File

@ -55,8 +55,8 @@ function check_environment_coherence {
exit 1
fi
local ANSIBLE_VERSION_MIN=2.9
local ANSIBLE_VERSION_MAX=2.10
local ANSIBLE_VERSION_MIN=2.10
local ANSIBLE_VERSION_MAX=2.11
if [[ $(printf "%s\n" "$ANSIBLE_VERSION_MIN" "$ANSIBLE_VERSION_MAX" "$ansible_version" | sort -V | head -n1) != "$ANSIBLE_VERSION_MIN" ]] ||
[[ $(printf "%s\n" "$ANSIBLE_VERSION_MIN" "$ANSIBLE_VERSION_MAX" "$ansible_version" | sort -V | tail -n1) != "$ANSIBLE_VERSION_MAX" ]]; then