From 1b650534c0046ae14edc45acef032148bdae6a83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Nasiadka?= Date: Thu, 17 Jun 2021 08:16:11 +0200 Subject: [PATCH] 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 --- ansible/library/kolla_toolbox.py | 8 +++++++- ansible/roles/prechecks/vars/main.yml | 4 ++-- doc/source/user/quickstart.rst | 6 +++--- releasenotes/notes/ansible-4-171c8afddfc325e8.yaml | 5 +++++ test-requirements.txt | 2 +- tests/run.yml | 2 +- tools/kolla-ansible | 4 ++-- 7 files changed, 21 insertions(+), 10 deletions(-) create mode 100644 releasenotes/notes/ansible-4-171c8afddfc325e8.yaml diff --git a/ansible/library/kolla_toolbox.py b/ansible/library/kolla_toolbox.py index c860c33bc9..3a613ef01d 100644 --- a/ansible/library/kolla_toolbox.py +++ b/ansible/library/kolla_toolbox.py @@ -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()) diff --git a/ansible/roles/prechecks/vars/main.yml b/ansible/roles/prechecks/vars/main.yml index 8e4a7e4379..ea32bd2910 100644 --- a/ansible/roles/prechecks/vars/main.yml +++ b/ansible/roles/prechecks/vars/main.yml @@ -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 diff --git a/doc/source/user/quickstart.rst b/doc/source/user/quickstart.rst index 0a954bc418..060ac25ee6 100644 --- a/doc/source/user/quickstart.rst +++ b/doc/source/user/quickstart.rst @@ -89,11 +89,11 @@ If not installing Kolla Ansible in a virtual environment, skip this section. pip install -U pip #. Install `Ansible `__. 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 `__. 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: diff --git a/releasenotes/notes/ansible-4-171c8afddfc325e8.yaml b/releasenotes/notes/ansible-4-171c8afddfc325e8.yaml new file mode 100644 index 0000000000..9360c563a6 --- /dev/null +++ b/releasenotes/notes/ansible-4-171c8afddfc325e8.yaml @@ -0,0 +1,5 @@ +--- +upgrade: + - | + Minimum supported Ansible version is now ``2.10`` and maximum supported + is ``4`` (ansible-core 2.11). diff --git a/test-requirements.txt b/test-requirements.txt index 8b10965c0a..ef84c6b8a8 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -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 diff --git a/tests/run.yml b/tests/run.yml index 7f3c953291..6b5b90b739 100644 --- a/tests/run.yml +++ b/tests/run.yml @@ -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 }} diff --git a/tools/kolla-ansible b/tools/kolla-ansible index a6d222b7ab..1826b3d4e4 100755 --- a/tools/kolla-ansible +++ b/tools/kolla-ansible @@ -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