This commit is contained in:
parent
94cb92d041
commit
588e8a0a8a
@ -1,5 +1,14 @@
|
||||
---
|
||||
python3_packages:
|
||||
- python3
|
||||
- python3-pip
|
||||
# @var python3_packages:description: >
|
||||
# The default packages depend on the OS version. For RHEL7 based systems, Python3.8 from
|
||||
# SCL `centos-sclo-rh`. Therefore, the SCL need to be installed and enabled already!
|
||||
# For RHEL8 based system Python3.9 will be installed from the Appstream repo.
|
||||
# @var python3_packages:default: "_unset_"
|
||||
|
||||
python3_packages_extra: []
|
||||
|
||||
# @var python3_packages_remove:description: Optional list of old Pathon packages that should be removed.
|
||||
python3_packages_remove: []
|
||||
|
||||
python3_link_bin: []
|
||||
python3_link_bin_path: /usr/bin
|
||||
|
@ -1,5 +1,9 @@
|
||||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
vars:
|
||||
python3_packages_extra:
|
||||
- centos-release-scl
|
||||
|
||||
roles:
|
||||
- role: xoxys.python3
|
||||
|
@ -1,2 +1,15 @@
|
||||
---
|
||||
- include_vars: "{{ var_files }}"
|
||||
vars:
|
||||
var_files: "{{ lookup('first_found', params, errors='ignore') }}"
|
||||
params:
|
||||
files:
|
||||
- "{{ ansible_lsb.id | default('') | lower }}.yml"
|
||||
- "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version }}.yml"
|
||||
- "{{ ansible_os_family | lower }}.yml"
|
||||
paths:
|
||||
- "vars"
|
||||
when: var_files
|
||||
|
||||
- include_tasks: overwrites.yml
|
||||
- include_tasks: setup.yml
|
||||
|
5
tasks/overwrites.yml
Normal file
5
tasks/overwrites.yml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
- name: Define python3_packages
|
||||
set_fact:
|
||||
python3_packages: "{{ __python3_packages | list }}"
|
||||
when: python3_packages is not defined
|
@ -5,17 +5,21 @@
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
loop: "{{ python3_packages_extra + python3_packages }}"
|
||||
|
||||
- name: Link binaries to '{{ __python3_link_bin_path }}'
|
||||
|
||||
- name: Remove other Python pckages
|
||||
package:
|
||||
name: "{{ item }}"
|
||||
state: absent
|
||||
loop: "{{ python3_packages_remove }}"
|
||||
|
||||
- name: Link binaries to '{{ python3_link_bin_path }}'
|
||||
file:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ __python3_link_bin_path }}/{{ item.dest }}"
|
||||
dest: "{{ python3_link_bin_path }}/{{ item.dest }}"
|
||||
state: link
|
||||
force: yes
|
||||
loop:
|
||||
- { src: /usr/bin/python3.6, dest: python3 }
|
||||
- { src: /usr/bin/pip3.6, dest: pip3 }
|
||||
loop: "{{ python3_link_bin }}"
|
||||
loop_control:
|
||||
label: "{{ __python3_link_bin_path }}/{{ item.dest }}"
|
||||
label: "{{ python3_link_bin_path }}/{{ item.dest }}"
|
||||
become: True
|
||||
become_user: root
|
||||
|
@ -1,2 +0,0 @@
|
||||
---
|
||||
__python3_link_bin_path: /usr/bin
|
4
vars/redhat-7.yml
Normal file
4
vars/redhat-7.yml
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
__python3_packages:
|
||||
- rh-python38
|
||||
- rh-python38-python-pip
|
4
vars/redhat-8.yml
Normal file
4
vars/redhat-8.yml
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
__python3_packages:
|
||||
- python39
|
||||
- python39-pip
|
Loading…
Reference in New Issue
Block a user