nmusatti.source_python
Ansible Role: source-python
This Ansible role is designed to download and install Python from its source code. It supports the latest versions of the Red Hat family (like CentOS and Fedora) and Ubuntu. Currently, tests are conducted on several versions, including Rocky Linux 9 and 8, CentOS Stream 9, 8, and 7, Fedora 37, 36, and 35, as well as Ubuntu 22.04, 20.04, and 18.04.
Requirements
No special requirements.
Role Variables
Here are the variables that you can use to customize how the role behaves, along with their default values:
python_install_dir:
/opt
- The main directory where Python will be installed.
python_release:
3.10.0
- The specific version of Python to install (in x.y.z format).
python_user:
python
- The user who will own the installation.
python_group:
python
- The group that will own the installation.
python_src_dir:
/sw/python
- The directory for downloading, extracting, and building the Python source files.
python_force:
false
- If set to
true
, the installation will proceed even if the same minor version has already been installed. This is helpful for reinstalling or upgrading when there are issues. Be aware that this breaks the role’s idempotency.
- If set to
Dependencies
No dependencies.
Example Playbook
Here’s an example of how to use this role in a playbook:
- hosts: servers
roles:
- role: nmusatti.source_python
vars:
python_release: 3.10.0
Remember to include the underscore in the role name, as Ansible Galaxy requires it.
License
This project is licensed under GPLv3.
Author Information
Nicola Musatti - GitHub Profile
ansible-galaxy install nmusatti.source_python