An Ansible role that installs a specific base python+pip version (major.minor
only).
The executables will be available at /usr/bin/python3.7
and /usr/local/bin/pip3.7
, for the python_base_version
specified.
The role is tested against: Ubuntu 16.04/18.04/20.04, Fedora 31 and CentOS 8 for python versions 3.6
, 3.7
and 3.8
.
You can also specify a path in which to create a virtualenv which uses this python version, with python_venv_path
. By default python_venv_packages
is set to install the latest pip, setuptools and wheel versions.
ansible-galaxy install marvel-nccr.python
See defaults/main.yml
- hosts: servers
roles:
- role: marvel-nccr.python
vars:
python_base_version: "3.7"
python_install_dev: true
python_venv_path: "/tmp/my_venv"
python_venv_packages:
- pip
- setuptools
- wheel
python_venv_state: latest
- Python 3.7 is not available on CentOS 8
python_install_dev
andpython_install_tk
will not work for Fedora 31 if no Python 3.7 (python3-devel
andpython3-tkinter
will be installed, which only work for the default python 3.7 version)
This role uses Molecule and Docker for tests.
After installing Docker:
Clone the repository into a package named marvel-nccr.python
(the folder must be named the same as the Ansible Galaxy name)
git clone https://github.com/marvel-nccr/ansible-role-python marvel-nccr.python
cd marvel-nccr.python
Then run:
pip install -r requirements.txt # Installs molecule
molecule test # runs tests
or use tox (see tox.ini
):
pip install tox
tox
For testing specific distributions and python versions, .e.g.:
MOLECULE_DISTRO=centos8 MOLECULE_PYTHON_VERSION=3.8 tox
To manually inspect a container, you can run the converge and destroy steps individually:
tox converge
tox destroy
Code style is formatted and linted with pre-commit.
pip install pre-commit
pre-commit run -all
Deployment to Ansible Galaxy is automated via GitHub Actions.
Simply tag a release vX.Y.Z
to initiate the CI and release workflow.
Note, the release will only complete if the CI tests pass.
MIT
Please direct inquiries regarding Quantum Mobile and associated ansible roles to the AiiDA mailinglist.