Use special RHOSP vars files in tobiko-ensure-python3 role

Change-Id: I09055d0610ddc26c0ada947f95d823c28e9494b4
This commit is contained in:
Federico Ressi 2020-06-08 16:25:58 +02:00
parent 151bfae959
commit 2c38d883bb
5 changed files with 58 additions and 15 deletions

View File

@ -19,3 +19,13 @@ python_info: {}
enable_yum_repos: []
compile_python3: no
python_vars_prefixes:
- py3
python_vars_names:
- "{{ ansible_distribution }}-{{ ansible_distribution_version }}"
- "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}"
- "{{ ansible_os_family }}-{{ ansible_distribution_major_version }}"
- "{{ ansible_distribution }}"
- "{{ ansible_os_family }}"

View File

@ -3,7 +3,7 @@
- name: "enable yum repos"
become: yes
shell:
yum-config-manager --enable '{{ item }}' |grep baseurl
yum-config-manager --enable '{{ item }}' | grep baseurl
loop: '{{ enable_yum_repos }}'

View File

@ -1,23 +1,44 @@
---
- name: "show ansible distro variables"
debug:
msg:
ansible_architecture: '{{ ansible_architecture }}'
ansible_distribution: '{{ ansible_distribution }}'
ansible_distribution_major_version: '{{ ansible_distribution_major_version }}'
ansible_os_family: '{{ ansible_os_family }}'
- when: osp_version is not defined
block:
- name: "get RHOSP version"
register: get_rhosp_version
shell:
awk '{print $6}' /etc/rhosp-release
- name: show RHOSP version
debug: var=get_rhosp_version.stdout_lines
- name: set rhosp_version and python_vars_prefixes facts
set_fact:
rhosp_version: '{{ get_rhosp_version.stdout_lines | first }}'
python_vars_prefixes: "{{ ['rhosp'] + python_vars_prefixes }}"
rescue:
- debug:
msg='this is not an RHOSP host'
- name:
set_fact:
python_vars_files: >
{{ python_vars_prefixes |
product(python_vars_names) |
map('join', '-') |
product(['yaml']) |
map('join', '.') |
list }}
- name: "show platform vars files"
debug: var=python_vars_files
- name: "include platform variables"
include_vars: "{{ item }}"
ignore_errors: yes
with_first_found:
- "py3-{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yaml"
- "py3-{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.yaml"
- "py3-{{ ansible_distribution }}.{{ ansible_architecture }}.yaml"
- "py3-{{ ansible_distribution }}.yaml"
- "py3-{{ ansible_os_family }}.yaml"
with_first_found: '{{ python_vars_files }}'
register: include_platform_vars

View File

@ -1,7 +1,7 @@
---
enable_yum_repos:
- rhelosp-rhel-*-server-opt
- rhel-7-server-optional-rpms
python_packages:
python3:

View File

@ -0,0 +1,12 @@
---
enable_yum_repos:
- rhelosp-rhel-*-server-opt
python_packages:
python3:
- python3
- python3-devel
python3.6:
- python36
- python36-devel