Improve dnf test formatting and fix RHEL 8 module name (#58648)

- use single include_vars task rather than multiple set_fact tasks
- use multi-line YAML to break up long conditionals
- use version() test rather than direct comparisions
- use different appstream package on RHEL since '@swig:3.0/default' is not working in the GA
This commit is contained in:
Sam Doran 2019-07-03 11:11:20 -04:00 committed by GitHub
parent 2e9db87a1b
commit 16d6fcf514
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 23 deletions

View file

@ -6,6 +6,8 @@
shell: rpm -q python2-dnf
register: rpm_result
ignore_errors: true
args:
warn: no
# Don't uninstall python2-dnf with the `dnf` module in case it needs to load
# some dnf python files after the package is uninstalled.

View file

@ -19,23 +19,24 @@
# Note: We install the yum package onto Fedora so that this will work on dnf systems
# We want to test that for people who don't want to upgrade their systems.
- include: 'dnf.yml'
when:
- (ansible_distribution == 'Fedora' and ansible_distribution_major_version|int >= 23) or (ansible_distribution == 'RedHat' and ansible_distribution_major_version|int >= 8)
- include_tasks: dnf.yml
when: (ansible_distribution == 'Fedora' and ansible_distribution_major_version is version('23', '>=')) or
(ansible_distribution == 'RedHat' and ansible_distribution_major_version is version('8', '>='))
- include: 'repo.yml'
when:
- (ansible_distribution == 'Fedora' and ansible_distribution_major_version|int >= 23) or (ansible_distribution == 'RedHat' and ansible_distribution_major_version|int >= 8)
- include_tasks: repo.yml
when: (ansible_distribution == 'Fedora' and ansible_distribution_major_version is version('23', '>=')) or
(ansible_distribution == 'RedHat' and ansible_distribution_major_version is version('8', '>='))
- include: 'dnfinstallroot.yml'
when:
- (ansible_distribution == 'Fedora' and ansible_distribution_major_version|int >= 23) or (ansible_distribution == 'RedHat' and ansible_distribution_major_version|int >= 8)
- include_tasks: dnfinstallroot.yml
when: (ansible_distribution == 'Fedora' and ansible_distribution_major_version is version('23', '>=')) or
(ansible_distribution == 'RedHat' and ansible_distribution_major_version is version('8', '>='))
# Attempting to install a different RHEL release in a tmpdir doesn't work (rhel8 beta)
- include: 'dnfreleasever.yml'
- include_tasks: dnfreleasever.yml
when:
- ansible_distribution == 'Fedora' and ansible_distribution_major_version|int >= 23
- ansible_distribution == 'Fedora'
- ansible_distribution_major_version is version('23', '>=')
- import_tasks: 'modularity.yml'
when:
- (ansible_distribution == 'Fedora' and ansible_distribution_major_version|int >= 29) or (ansible_distribution == 'RedHat' and ansible_distribution_major_version|int >= 8)
- include_tasks: modularity.yml
when: (ansible_distribution == 'Fedora' and ansible_distribution_major_version is version('29', '>=')) or
(ansible_distribution == 'RedHat' and ansible_distribution_major_version is version('8', '>='))

View file

@ -1,13 +1,6 @@
# FUTURE - look at including AppStream support in our local repo
- name: set package for RHEL
set_fact:
astream_name: '@swig:3.0/default'
when: ansible_distribution == 'RedHat'
- name: set package for Fedora
set_fact:
astream_name: '@ripgrep:master/default'
when: ansible_distribution == 'Fedora'
- name: Include distribution specific variables
include_vars: "{{ ansible_facts.distribution }}.yml"
- name: install "{{ astream_name }}" module
dnf:

View file

@ -0,0 +1 @@
astream_name: '@ripgrep:master/default'

View file

@ -0,0 +1 @@
astream_name: '@php:7.1/minimal'