Add support for RPM packages
This commit extends the installation of Python interpreter from system packages to also support RPM packages (assuming the playbook is run in an environment with proper repositories). Also the obsolete note about supporting only Debian distribution is removed, as the `ensure-python` role already supports other platforms (via pyenv and stow). Change-Id: Id6ef8ec3537952348e0a7b233bd26b57613da327
This commit is contained in:
parent
88c1c731e6
commit
ced6cd132f
@ -1,12 +1,9 @@
|
|||||||
Ensure specified python interpreter and development files are installed
|
Ensure specified python interpreter and development files are installed
|
||||||
|
|
||||||
.. note:: This role is only available for Debian based platforms
|
|
||||||
currently.
|
|
||||||
|
|
||||||
There are three ways to install the python interpreter:
|
There are three ways to install the python interpreter:
|
||||||
|
|
||||||
1. Using distribution packages: This is the default (``python_use_pyenv`` and
|
1. Using distribution packages: This is the default (``python_use_pyenv`` and
|
||||||
``python_use_stow`` are both false``).
|
``python_use_stow`` are both ``false``).
|
||||||
|
|
||||||
2. Install using ``pyenv``.
|
2. Install using ``pyenv``.
|
||||||
|
|
||||||
|
@ -6,16 +6,27 @@
|
|||||||
- (python_version|string).split(".")[1]
|
- (python_version|string).split(".")[1]
|
||||||
when: python_version is defined
|
when: python_version is defined
|
||||||
|
|
||||||
- name: Install specified version of python interpreter and development files
|
- name: Install python using system packages
|
||||||
when:
|
when:
|
||||||
- python_version is defined
|
- python_version is defined
|
||||||
- ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
|
|
||||||
- not python_use_pyenv
|
- not python_use_pyenv
|
||||||
- not python_use_stow
|
- not python_use_stow
|
||||||
package:
|
block:
|
||||||
name: python{{ python_version }}-dev
|
- name: Install specified version of python interpreter and development files (DEB)
|
||||||
state: present
|
when:
|
||||||
become: yes
|
- ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
|
||||||
|
package:
|
||||||
|
name: python{{ python_version }}-dev
|
||||||
|
state: present
|
||||||
|
become: yes
|
||||||
|
|
||||||
|
- name: Install specified version of python interpreter and development files (RPM)
|
||||||
|
when:
|
||||||
|
- ansible_distribution == 'CentOS' or ansible_distribution == 'RedHat'
|
||||||
|
package:
|
||||||
|
name: python{{ python_version | replace('.', '') }}-devel
|
||||||
|
state: present
|
||||||
|
become: yes
|
||||||
|
|
||||||
- name: Install python using pyenv
|
- name: Install python using pyenv
|
||||||
when:
|
when:
|
||||||
|
Loading…
Reference in New Issue
Block a user