From b9da05be556ad8fb847d968a7240557829c5bfdb Mon Sep 17 00:00:00 2001
From: Mark Goddard <mark@stackhpc.com>
Date: Mon, 1 Jul 2019 11:37:02 +0100
Subject: [PATCH] Test minimum supported and latest versions of Ansible

We have a minimum supported version of Ansible, currently 2.5. We should
test this in addition to the latest version. This change tests latest on
Ubuntu, and minimum on other distros.

Change-Id: I45a7173139f057177a71e919ad3e718a99d9f87b
---
 tools/setup_gate.sh | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tools/setup_gate.sh b/tools/setup_gate.sh
index 036521752c..54922f6024 100755
--- a/tools/setup_gate.sh
+++ b/tools/setup_gate.sh
@@ -92,8 +92,14 @@ function detect_distro {
 function setup_ansible {
     RAW_INVENTORY=/etc/kolla/inventory
 
+    # Test latest ansible version on Ubuntu, minimum supported on others.
+    if [[ $BASE_DISTRO == "ubuntu" ]]; then
+        ANSIBLE_VERSION=">=2.5"
+    else
+        ANSIBLE_VERSION="<2.6"
+    fi
     # TODO(SamYaple): Move to virtualenv
-    sudo -H pip install -U "ansible>=2.5" "docker>=2.0.0" "python-openstackclient" "ara<1.0.0" "cmd2<0.9.0"
+    sudo -H pip install -U "ansible${ANSIBLE_VERSION}" "docker>=2.0.0" "python-openstackclient" "ara<1.0.0" "cmd2<0.9.0"
     if [[ $ACTION == "zun" ]]; then
         sudo -H pip install -U "python-zunclient"
     fi