From 7d3ab66ee0fe9cf6c1d2b0fc7f25b3577a438ca6 Mon Sep 17 00:00:00 2001
From: Tim Burke <tim.burke@gmail.com>
Date: Fri, 28 Apr 2023 13:16:51 -0700
Subject: [PATCH] Fix installation of py27 on CentOS 7/8

Some projects (such as pyeclib) might want to run openstack-tox-py27
with a centos-7 nodeset.

Change-Id: If636f5350021d8733a8ecc52c71626aa3d601064
---
 playbooks/tox/py27.yaml | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/playbooks/tox/py27.yaml b/playbooks/tox/py27.yaml
index 3043c66e..f60ee78a 100644
--- a/playbooks/tox/py27.yaml
+++ b/playbooks/tox/py27.yaml
@@ -17,3 +17,18 @@
           - python
           - python-dev
         state: present
+      when: ansible_facts['distribution'] != "CentOS"
+    - name: Install Python 2.7 for CentOS 7
+      package:
+        name:
+          - python
+          - python-devel
+        state: present
+      when: (ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version'] == "7")
+    - name: Install Python 2.7 for CentOS 8
+      package:
+        name:
+          - python2
+          - python2-devel
+        state: present
+      when: (ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version'] == "8")