Skip to content
Snippets Groups Projects
Verified Commit 08b04d38 authored by Elliot's avatar Elliot
Browse files

Resolve issues raised by LukeM's review

* Remove duplicated code.
* Clean up conditionals.
* Shorten fail message.
parent e48efd73
Branches
No related tags found
1 merge request!3Enable use of role on CentOS 7
Pipeline #2493 passed
---
- name: Check OS distribution and version
set_fact:
distro_ok: "{{ ansible_distribution == 'CentOS' }}"
version_ok: "{{ ansible_distribution_major_version in ['6', '7'] }}"
- name: Ensure an error is raised on unsupported OS
fail:
msg: "Currently Software Collections are only supported on CentOS 6 and 7. Do not install on other setups - see role README"
when: ansible_distribution != "CentOS" or (ansible_distribution_major_version != "6" and ansible_distribution_major_version != "7")
- name: Add Software Collections on CentOS 6
import_tasks: scl-centos6.yml
when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "6"
msg: "Only CentOS 6 and 7 are supported"
when: not (distro_ok and version_ok)
- name: Add Software Collections on CentOS 7
import_tasks: scl-centos7.yml
when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "7"
- name: Add Software Collections for CentOS
yum:
name: centos-release-scl
state: present
when:
- distro_ok
- version_ok
---
- name: Add Software Collections for CentOS 6
yum:
name: centos-release-scl
state: present
---
- name: Add Software Collections for CentOS 7
yum:
name: centos-release-scl
state: present
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment