From ef29455652b56de65a3fd10e4d3d40f4be9f4ceb Mon Sep 17 00:00:00 2001
From: Cristian Calin <6627509+cristicalin@users.noreply.github.com>
Date: Wed, 30 Mar 2022 01:36:11 +0300
Subject: [PATCH] [ansible] make ansible 5.x the new default version (#8660)

* [ansible] make ansible 5.x the new default version and move different versions tested to nightly jobs

* [CI] jobs were missing proper ansible cleanup
---
 .gitlab-ci/lint.yml                              |  2 +-
 .gitlab-ci/packet.yml                            | 16 ++++++++--------
 .gitlab-ci/vagrant.yml                           |  4 ++--
 docs/ansible.md                                  |  2 +-
 requirements.txt                                 |  2 +-
 .../packet_ubuntu20-calico-aio-ansible-2_12.yml  |  1 -
 tests/requirements.txt                           |  2 +-
 7 files changed, 14 insertions(+), 15 deletions(-)
 delete mode 120000 tests/files/packet_ubuntu20-calico-aio-ansible-2_12.yml

diff --git a/.gitlab-ci/lint.yml b/.gitlab-ci/lint.yml
index 3b59c3ba5..57c8b0847 100644
--- a/.gitlab-ci/lint.yml
+++ b/.gitlab-ci/lint.yml
@@ -52,7 +52,7 @@ tox-inventory-builder:
     - ./tests/scripts/rebase.sh
     - apt-get update && apt-get install -y python3-pip
     - update-alternatives --install /usr/bin/python python /usr/bin/python3 10
-    - python -m pip uninstall -y ansible
+    - python -m pip uninstall -y ansible ansible-base ansible-core
     - python -m pip install -r tests/requirements.txt
   script:
     - pip3 install tox
diff --git a/.gitlab-ci/packet.yml b/.gitlab-ci/packet.yml
index 0805e7357..a09627597 100644
--- a/.gitlab-ci/packet.yml
+++ b/.gitlab-ci/packet.yml
@@ -31,29 +31,29 @@ packet_ubuntu20-calico-aio:
   variables:
     RESET_CHECK: "true"
 
-# Exericse ansible variants
+# Exericse ansible variants during the nightly jobs
 packet_ubuntu20-calico-aio-ansible-2_9:
   stage: deploy-part1
-  extends: .packet_pr
+  extends: .packet_periodic
   when: on_success
   variables:
     ANSIBLE_MAJOR_VERSION: "2.9"
     RESET_CHECK: "true"
 
-packet_ubuntu20-calico-aio-ansible-2_11:
+packet_ubuntu20-calico-aio-ansible-2_10:
   stage: deploy-part1
-  extends: .packet_pr
+  extends: .packet_periodic
   when: on_success
   variables:
-    ANSIBLE_MAJOR_VERSION: "2.11"
+    ANSIBLE_MAJOR_VERSION: "2.10"
     RESET_CHECK: "true"
 
-packet_ubuntu20-calico-aio-ansible-2_12:
+packet_ubuntu20-calico-aio-ansible-2_11:
   stage: deploy-part1
-  extends: .packet_pr
+  extends: .packet_periodic
   when: on_success
   variables:
-    ANSIBLE_MAJOR_VERSION: "2.12"
+    ANSIBLE_MAJOR_VERSION: "2.11"
     RESET_CHECK: "true"
 
 # ### PR JOBS PART2
diff --git a/.gitlab-ci/vagrant.yml b/.gitlab-ci/vagrant.yml
index d2b51d029..a13028dda 100644
--- a/.gitlab-ci/vagrant.yml
+++ b/.gitlab-ci/vagrant.yml
@@ -11,7 +11,7 @@ molecule_tests:
     - tests/scripts/rebase.sh
     - apt-get update && apt-get install -y python3-pip
     - update-alternatives --install /usr/bin/python python /usr/bin/python3 10
-    - python -m pip uninstall -y ansible
+    - python -m pip uninstall -y ansible ansible-base ansible-core
     - python -m pip install -r tests/requirements.txt
     - ./tests/scripts/vagrant_clean.sh
   script:
@@ -38,7 +38,7 @@ molecule_tests:
   before_script:
     - apt-get update && apt-get install -y python3-pip
     - update-alternatives --install /usr/bin/python python /usr/bin/python3 10
-    - python -m pip uninstall -y ansible
+    - python -m pip uninstall -y ansible ansible-base ansible-core
     - python -m pip install -r tests/requirements.txt
     - ./tests/scripts/vagrant_clean.sh
   script:
diff --git a/docs/ansible.md b/docs/ansible.md
index 9078d9d8f..e0bdc6d49 100644
--- a/docs/ansible.md
+++ b/docs/ansible.md
@@ -267,7 +267,7 @@ that explains in detail the need and the evolution plan.
 You first need to uninstall your old ansible (pre 2.10) version and install the new one.
 
 ```ShellSession
-pip uninstall ansible
+pip uninstall ansible ansible-base ansible-core
 cd kubespray/
 pip install -U .
 ```
diff --git a/requirements.txt b/requirements.txt
index 5202ea4fb..ac782c9e7 120000
--- a/requirements.txt
+++ b/requirements.txt
@@ -1 +1 @@
-requirements-2.10.txt
\ No newline at end of file
+requirements-2.12.txt
\ No newline at end of file
diff --git a/tests/files/packet_ubuntu20-calico-aio-ansible-2_12.yml b/tests/files/packet_ubuntu20-calico-aio-ansible-2_12.yml
deleted file mode 120000
index 10064637f..000000000
--- a/tests/files/packet_ubuntu20-calico-aio-ansible-2_12.yml
+++ /dev/null
@@ -1 +0,0 @@
-packet_ubuntu20-calico-aio.yml
\ No newline at end of file
diff --git a/tests/requirements.txt b/tests/requirements.txt
index 5202ea4fb..ac782c9e7 120000
--- a/tests/requirements.txt
+++ b/tests/requirements.txt
@@ -1 +1 @@
-requirements-2.10.txt
\ No newline at end of file
+requirements-2.12.txt
\ No newline at end of file
-- 
GitLab