PPA in ubuntu > 14.04.

This commit is contained in:
Andrea Dell'Amico 2023-03-01 16:29:17 +01:00
parent 52a988e55e
commit 68889c890c
Signed by: adellam
GPG Key ID: 147ABE6CEB9E20FF
3 changed files with 17 additions and 12 deletions

View File

@ -1,5 +1,6 @@
---
py3_env_install: true
py3_env_ppa_enabled: false
py3_env_major_version: 3
# We calculate the minor number is some cases.
py3_env_minor_version: 6

View File

@ -1,14 +1,15 @@
---
- block:
- name: Manage the python 3 ppa
tags: [python, py3_env, py3_env_pkgs, python3, py3_apt]
when:
- py3_env_install
- ansible_distribution_version is version_compare('18.04', '<') or py3_env_ppa_enabled
block:
- name: Install the python 3 ppa repository
apt_repository: repo={{ py3_ppa }} update_cache=yes state=present
when:
- py3_env_install
- ansible_distribution_version is version_compare('18.04', '<')
tags: [ "python", "py3_env", "py3_env_pkgs", 'python3' ]
- name: Find the appropriate python3 minor version
tags: ["python", "py3_env", "py3_env_pkgs", 'python3']
block:
- name: Python minor version of Ubuntu 20.04
ansible.builtin.set_fact:
@ -20,7 +21,10 @@
py3_env_minor_version: '10'
when: ansible_distribution_version is version_compare('22.04', '==')
- block:
- name: Manage the python packages
tags: [python, py3_env, py3_env_pkgs, python3, py3_apt]
when: py3_env_install
block:
- name: Install the python3 mandatory deb packages
apt: name={{ py3_env_mandatory_dpkg }} state={{ py3_env_pkgs_state }} update_cache=yes cache_valid_time=600
@ -31,6 +35,10 @@
apt: name=python3-pip state={{ py3_env_pkgs_state }} update_cache=yes cache_valid_time=600
when: ansible_distribution_version is version_compare('18.04', '>=')
- name: Manage the python pip packages
tags: [python, py3_env, py3_env_pkgs, python3, py3_pip]
when: py3_env_install
block:
- name: Remove info of deb python packages so that they can be upgraded using pip
file:
dest: '{{ item }}'
@ -72,7 +80,3 @@
pip: executable=pip{{ py3_env_major_version }} name={{ py3_env_pip_pkgs }} state={{ py3_pip_pkgs_state }}
when: ansible_distribution_version is version_compare('18.04', '>=')
tags: [ "python", "py3_env", "py3_env_pkgs", 'python3', 'py3_pkgs_latest' ]
when: py3_env_install
tags: [ "python", "py3_env", "py3_env_pkgs", 'python3' ]

View File

@ -16,4 +16,4 @@ py3_el_env_mandatory_pkg:
- 'python{{ py3_env_major_version }}'
- 'python{{ py3_env_major_version }}-pip'
- 'python{{ py3_env_major_version }}-setuptools'
- "python{% if ansible_distribution_version is version_compare('18.04', '<=') %}{{ py3_el_env_version }}{% else %}{{ py3_env_major_version }}{% endif %}-virtualenv"
- "python{% if py3_env_ppa_enabled %}{{ py3_el_env_version }}{% else %}{{ py3_env_major_version }}{% endif %}-virtualenv"