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

Enable use of role on CentOS 7

parent 254e1fe2
No related branches found
No related tags found
1 merge request!3Enable use of role on CentOS 7
Pipeline #2485 passed
......@@ -46,7 +46,7 @@ To run the tests do:
$pipenv run molecule test
```
The tests should pass. As this is a CentOs 6 only module at the moment, the default scenario only runs on CentOS 6. To make sure the role fails with an error on other platforms, you can test the 'fail' scenario:
The tests should pass. As this is a CentOs 6 and 7 module at the moment, the default scenario runs on CentOS 6 and 7. To make sure the role fails with an error on other platforms, you can test the 'fail' scenario:
```
$pipenv run molecule test -s fail
......
......@@ -8,6 +8,8 @@ lint:
platforms:
- name: CentOs6
image: centos:6
- name: CentOs7
image: centos:7
provisioner:
name: ansible
lint:
......
......@@ -7,7 +7,7 @@ lint:
name: yamllint
platforms:
- name: instance
image: centos:7
image: debian:7
provisioner:
name: ansible
lint:
......
---
- name: Ensure an error is raised on unsupported OS
fail:
msg: "Currently Software Collections are only supported on CentOS 6. Do not install on other setups - see role README"
when: ansible_distribution != "CentOS" or ansible_distribution_major_version != "6"
register: os_is_supported_check
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
yum:
name: centos-release-scl
state: present
when: os_is_supported_check is succeeded
- name: Add Software Collections on CentOS 6
import_tasks: scl-centos6.yml
when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "6"
- 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 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