Skip to content

Commit

Permalink
Merge pull request #11 from sbesson/disablerepo_epel
Browse files Browse the repository at this point in the history
Disable EPEL repository when installing NGINX
  • Loading branch information
sbesson authored Jul 13, 2021
2 parents eb6cd6f + 4373dfd commit c89f651
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions molecule/centos7/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ provisioner:
name: ansible
playbooks:
converge: ../resources/playbook.yml
prepare: prepare.yml
lint:
name: ansible-lint
inventory:
Expand Down
8 changes: 8 additions & 0 deletions molecule/centos7/prepare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
- hosts: nginx-disabled
tasks:
- name: Install epel
become: true
yum:
name: epel-release
state: present
8 changes: 7 additions & 1 deletion molecule/centos7/tests/test_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,10 @@ def test_version(host):
if hostname == 'nginx-custom':
assert ver == ('nginx version: nginx/1.15.8')
else:
assert ver.startswith('nginx version: nginx/1.18.')
assert ver.startswith('nginx version: nginx/1.20.1')


def test_nginx_configuration(host):
c = host.file('/etc/nginx/nginx.conf')
assert 'http {' in c.content_string
assert 'server {' not in c.content_string
6 changes: 6 additions & 0 deletions tasks/redhat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,19 @@
mode: 0644
when: not nginx_stable_repo

- name: system packages | check if epel is installed
stat:
path: '/etc/yum.repos.d/epel.repo'
register: epel_repo

- name: system packages | install nginx
become: true
yum:
name: >-
nginx{{ (nginx_version | length > 0) |
ternary('-' + nginx_version, '') }}
state: present
disablerepo: "{{ epel_repo.stat.exists | ternary('epel', '') }}"

# example_ssl.conf is in some distro versions but not upstream, disable it
# just in case
Expand Down

0 comments on commit c89f651

Please sign in to comment.