ansible-role-nginx/tasks/opensource/install-redhat.yml
Jurgen Verhasselt 3a63b9acf6
Add 'nginx_manage_repo' feature flag and defaults (#420)
Co-authored-by: Jurgen Verhasselt <hello@sjugge.be>
Co-authored-by: Jurgen Verhasselt <sjugge@inuits.eu>
2021-06-14 16:57:18 +02:00

39 lines
1.1 KiB
YAML

---
- name: (CentOS/RHEL 6/7) Configure NGINX repository
yum_repository:
name: nginx
baseurl: "{{ nginx_repository | default(nginx_default_repository_redhat) }}"
description: NGINX Repository
enabled: true
gpgcheck: true
mode: 0644
when:
- ansible_facts['distribution_major_version'] is version('8', '<')
- nginx_manage_repo | bool
- name: (CentOS/RHEL 8) Configure NGINX repository
blockinfile:
path: /etc/yum.repos.d/nginx.repo
create: true
block: |
[nginx]
baseurl = {{ nginx_repository | default(nginx_default_repository_redhat) }}
enabled = 1
gpgcheck = 1
name = NGINX Repository
module_hotfixes = true
mode: 0644
when:
- ansible_facts['distribution_major_version'] is version('8', '==')
- nginx_manage_repo | bool
- name: (CentOS/RHEL) Install NGINX
yum:
name: "nginx{{ nginx_version | default('') }}"
state: "{{ nginx_state }}"
disablerepo: "*"
enablerepo: nginx
update_cache: true
ignore_errors: "{{ ansible_check_mode }}"
notify: (Handler) Run NGINX