Merge "Bump up Ansible max supported ver to 4.x"

This commit is contained in:
Zuul 2021-09-24 16:43:01 +00:00 committed by Gerrit Code Review
commit d85af34ccd
7 changed files with 21 additions and 10 deletions

View File

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

View File

@ -1,8 +1,8 @@
--- ---
docker_version_min: '18.09' docker_version_min: '18.09'
docker_py_version_min: '3.4.1' docker_py_version_min: '3.4.1'
ansible_version_min: '2.9' ansible_version_min: '2.10'
ansible_version_max: '2.10' ansible_version_max: '2.11'
# Top level keys should match ansible_facts.distribution. # Top level keys should match ansible_facts.distribution.
# These map to lists of supported releases (ansible_facts.distribution_release) or # 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 pip install -U pip
#. Install `Ansible <http://www.ansible.com>`__. Kolla Ansible requires at least #. 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 .. code-block:: console
pip install 'ansible<3.0' pip install 'ansible<5.0'
Install dependencies not using a virtual environment 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 sudo pip3 install -U pip
#. Install `Ansible <http://www.ansible.com>`__. Kolla Ansible requires at least #. 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: 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 docker>=2.4.2 # Apache-2.0
oslotest>=3.2.0 # Apache-2.0 oslotest>=3.2.0 # Apache-2.0
stestr>=2.0.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 - 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.9.*' if is_upgrade else '==2.10.*' }}" ansible_version_constraint: "{{ '==2.10.*' if is_upgrade else '==4.*' }}"
command: >- command: >-
python3 -m pip install --user python3 -m pip install --user
-c {{ upper_constraints_file }} -c {{ upper_constraints_file }}

View File

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