From fb5649bd2f303332ed1280baa9ab2f4db9c40ab3 Mon Sep 17 00:00:00 2001
From: Mark Goddard <mark@stackhpc.com>
Date: Thu, 27 Jan 2022 17:20:44 +0000
Subject: [PATCH] Bump up Ansible supported versions

This change bumps up the maximum supported Ansible version to 5.x
(ansible-core 2.12.x) and minimum to 4.x. This synchronises Kayobe with
Kolla Ansible (see change Ia373f9cc3bb69eba0288bbb3e497e8cadb7cc4d3).

ansible 5 / ansible-core 2.12 raises the minimum version of Python to
3.8, so CentOS Stream 8 environments will typically get ansible 4 /
ansible-core 2.11.

Change-Id: If4477e7fa4c022ead6cda4a34a72b342f115936f
---
 ansible/roles/kolla-ansible/tasks/install.yml    |  2 +-
 ansible/roles/swift-block-devices/tests/main.yml |  6 +++---
 .../notes/ansible-max-5-dd929737c46f20ec.yaml    | 16 ++++++++++++++++
 requirements.txt                                 |  2 +-
 4 files changed, 21 insertions(+), 5 deletions(-)
 create mode 100644 releasenotes/notes/ansible-max-5-dd929737c46f20ec.yaml

diff --git a/ansible/roles/kolla-ansible/tasks/install.yml b/ansible/roles/kolla-ansible/tasks/install.yml
index 95bea4da..7fda514c 100644
--- a/ansible/roles/kolla-ansible/tasks/install.yml
+++ b/ansible/roles/kolla-ansible/tasks/install.yml
@@ -98,7 +98,7 @@
       # Limit the version of ansible used by kolla-ansible to avoid new
       # releases from breaking tested code. Changes to this limit should be
       # tested.
-      - ansible>=2.10.0,<5.0
+      - ansible>=4,<6.0
       - selinux
   pip:
     name: "{{ (kolla_ansible_packages + kolla_ansible_venv_extra_requirements) | select | list }}"
diff --git a/ansible/roles/swift-block-devices/tests/main.yml b/ansible/roles/swift-block-devices/tests/main.yml
index c5819f7b..85302804 100644
--- a/ansible/roles/swift-block-devices/tests/main.yml
+++ b/ansible/roles/swift-block-devices/tests/main.yml
@@ -1,7 +1,7 @@
 ---
-- include: test-invalid-format.yml
-- include: test-mount.yml
-- include: test-bootstrapped.yml
+- import_playbook: test-invalid-format.yml
+- import_playbook: test-mount.yml
+- import_playbook: test-bootstrapped.yml
 
 - hosts: localhost
   connection: local
diff --git a/releasenotes/notes/ansible-max-5-dd929737c46f20ec.yaml b/releasenotes/notes/ansible-max-5-dd929737c46f20ec.yaml
new file mode 100644
index 00000000..bf5cc13e
--- /dev/null
+++ b/releasenotes/notes/ansible-max-5-dd929737c46f20ec.yaml
@@ -0,0 +1,16 @@
+---
+upgrade:
+  - |
+    Updates the maximum supported version of Ansible from 4.x (ansible-core
+    2.11) to 5.x (ansible-core 2.12). The minimum supported version is updated
+    from 2.10 to 4.x. This is true for both Kayobe and Kolla Ansible. Note that
+    environments with Python 3.7 or lower (e.g. CentOS Stream 8) will be
+    limited to Ansible 4.x (ansible-core 2.11).
+  - |
+    Upgrading directly from Ansible 2.10 to Ansible 4 or later is known to
+    cause problems. You should uninstall ``ansible`` and ``ansible-base``
+    before upgrading your Kayobe virtual environment:
+
+    .. code-block:: console
+
+       pip uninstall ansible ansible-base
diff --git a/requirements.txt b/requirements.txt
index 8cfd1a87..634aff0e 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,5 +1,5 @@
 pbr>=2.0 # Apache-2.0
-ansible>=2.10.0,<5.0 # GPLv3
+ansible>=4,<6.0 # GPLv3
 cliff>=3.1.0 # Apache
 netaddr!=0.7.16,>=0.7.13 # BSD
 PyYAML>=3.10.0 # MIT
-- 
GitLab