Skip to content

Commit

Permalink
Switch to python3 for CentOS 7
Browse files Browse the repository at this point in the history
It fully drops py2 support.
  • Loading branch information
collivier committed Feb 2, 2023
1 parent 2763690 commit 89d9cf0
Show file tree
Hide file tree
Showing 3 changed files with 233 additions and 139 deletions.
56 changes: 43 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,24 @@ sudo su - xtesting

## Create a virtualenv (Optional)

It should be noted that ansible 2.9 or newer is required and that a few python
It should be noted that ansible 2.10 or newer is required and that a few python
packages are installed via pip. Therefore you may create a python virtualenv.
It's worth mentioning that CentOS forces us to give the virtual environment
access to the global site-packages (libselinux-python wouldn't be available).

Create Xtesting virtualenv (Debian Buster and Ubuntu Focal)
```bash
sudo apt update && sudo apt install virtualenv -y
virtualenv xtesting --system-site-packages
virtualenv xtesting -p python3 --system-site-packages
. xtesting/bin/activate
pip install ansible
```

Create Xtesting virtualenv (CentOS 8)
Create Xtesting virtualenv (CentOS 7)
```bash
sudo yum install epel-release -y
sudo yum install virtualenv -y
virtualenv xtesting --system-site-packages
virtualenv xtesting -p python3 --system-site-packages
. xtesting/bin/activate
pip install ansible
```
Expand All @@ -77,42 +77,72 @@ package is too old. It should be installed via pip in Ubuntu as well to avoid
mismatches between ansible and virtualenv Ubuntu packages. It should be noted
that git is only needed for the following playbooks.

Install dependencies (Debian Stretch):
Install dependencies (Debian Buster):
```bash
sudo apt update && sudo apt install git -y
[ -z "$VIRTUAL_ENV" ] && sudo apt install python-pip -y && sudo pip install ansible
sudo apt update -y && sudo apt install git -y
[ -z "$VIRTUAL_ENV" ] && sudo apt install python3-pip -y && sudo pip3 install ansible
ansible-galaxy install collivier.xtesting
ansible-galaxy collection install ansible.posix community.general community.grafana \
community.kubernetes community.docker community.postgresql
```

Install dependencies (Debian Buster):
**Install dependencies (Debian Bullseye):**
```bash
sudo apt update && sudo apt install git -y
[ -z "$VIRTUAL_ENV" ] && sudo apt install python-pip -y && sudo pip install ansible
sudo apt update -y && sudo apt install git -y
[ -z "$VIRTUAL_ENV" ] && apt install ansible -y
ansible-galaxy install collivier.xtesting
ansible-galaxy collection install ansible.posix community.general community.grafana \
community.kubernetes community.docker community.postgresql
```

Install dependencies (Ubuntu Bionic):
```bash
sudo apt update && sudo apt install git -y
sudo apt update -y && sudo apt install git -y
[ -z "$VIRTUAL_ENV" ] && sudo apt install python3-pip -y && sudo pip3 install ansible
ansible-galaxy install collivier.xtesting
ansible-galaxy collection install ansible.posix community.general community.grafana \
community.kubernetes community.docker community.postgresql
```

Install dependencies (Ubuntu Focal):
```bash
sudo apt update && sudo apt install git -y
sudo apt update -y && sudo apt install git -y
[ -z "$VIRTUAL_ENV" ] && sudo apt install python3-pip -y && sudo pip3 install ansible
ansible-galaxy install collivier.xtesting
ansible-galaxy collection install ansible.posix community.general community.grafana \
community.kubernetes community.docker community.postgresql
```

Install dependencies (CentOS 8):
**Install dependencies (Ubuntu Jammy):**
```bash
sudo apt update -y && sudo apt install git -y
[ -z "$VIRTUAL_ENV" ] && sudo apt install ansible -y
ansible-galaxy install collivier.xtesting
ansible-galaxy collection install ansible.posix community.general community.grafana \
community.kubernetes community.docker community.postgresql
```

Install dependencies (CentOS 7):
```bash
sudo yum install epel-release -y
sudo yum install git python3 python36-cryptography python36-PyYAML -y
[ -z "$VIRTUAL_ENV" ] && sudo pip3 install ansible
ansible-galaxy install collivier.xtesting
ansible-galaxy collection install ansible.posix community.general community.grafana \
community.kubernetes community.docker community.postgresql
```

Install dependencies (CentOS Stream 8):
```bash
sudo yum install epel-release -y
sudo yum install git python3 -y
[ -z "$VIRTUAL_ENV" ] && sudo yum install ansible -y
ansible-galaxy install collivier.xtesting
ansible-galaxy collection install ansible.posix community.general community.grafana \
community.kubernetes community.docker community.postgresql
```

**Install dependencies (CentOS Stream 9):**
```bash
sudo yum install epel-release -y
sudo yum install git -y
Expand Down
5 changes: 5 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
---
- name: Checking Python version
ansible.builtin.fail:
msg: Python 2 support was dropped
when:
- ansible_python.version.major==2
- name: Include prechecks.yml in play
ansible.builtin.include_tasks: prechecks.yml
- name: Include debian.yml in play
Expand Down
Loading

0 comments on commit 89d9cf0

Please sign in to comment.