2018-01-10 23:40:01 +01:00
|
|
|
---
|
2019-11-22 15:52:34 +01:00
|
|
|
- name: "(Install: CentOS/RedHat) Set Default YUM NGINX Repository"
|
|
|
|
set_fact:
|
|
|
|
default_repository: >-
|
|
|
|
https://nginx.org/packages/{{ (nginx_branch == 'mainline')
|
|
|
|
| ternary('mainline/', '') }}{{ (ansible_distribution == "RedHat")
|
|
|
|
| ternary('rhel', 'centos') }}/{{ ansible_distribution_major_version }}/$basearch/
|
|
|
|
|
|
|
|
- name: "(Install: CentOS/RedHat) Set YUM NGINX Repository"
|
|
|
|
set_fact:
|
|
|
|
repository: "{{ nginx_repository | default(default_repository) }}"
|
|
|
|
|
2020-06-18 14:34:51 +02:00
|
|
|
- name: "(Install: CentOS/RedHat) Add NGINX Repository for CentOS/RHEL 6/7"
|
2018-01-10 23:40:01 +01:00
|
|
|
yum_repository:
|
|
|
|
name: nginx
|
2019-11-22 15:52:34 +01:00
|
|
|
baseurl: "{{ repository }}"
|
2018-01-10 23:40:01 +01:00
|
|
|
description: NGINX Repository
|
|
|
|
enabled: yes
|
|
|
|
gpgcheck: yes
|
2020-06-18 14:34:51 +02:00
|
|
|
when: ansible_distribution_major_version < "8"
|
|
|
|
|
|
|
|
- name: "(Install: CentOS/RedHat) Add NGINX Repository for CentOS/RHEL 8"
|
|
|
|
blockinfile:
|
|
|
|
path: /etc/yum.repos.d/nginx.repo
|
|
|
|
create: true
|
|
|
|
block: |
|
|
|
|
[nginx]
|
|
|
|
baseurl = {{ repository }}
|
|
|
|
enabled = 1
|
|
|
|
gpgcheck = 1
|
|
|
|
name = NGINX Repository
|
|
|
|
module_hotfixes = true
|
|
|
|
when: ansible_distribution_major_version == "8"
|
2019-11-24 02:10:55 +01:00
|
|
|
|
2019-11-26 22:12:09 +01:00
|
|
|
- name: "(Install: CentOS/RedHat) Install Required CentOS/RedHat Dependencies"
|
|
|
|
yum:
|
|
|
|
name: openssl
|
|
|
|
|
2019-11-24 02:10:55 +01:00
|
|
|
- name: "(Install: CentOS/RedHat) Install NGINX"
|
|
|
|
yum:
|
|
|
|
name: "nginx{{ nginx_version | default('') }}"
|
2019-12-07 01:48:15 +01:00
|
|
|
state: "{{ nginx_state }}"
|
2019-11-26 22:12:09 +01:00
|
|
|
disablerepo: "*"
|
|
|
|
enablerepo: "nginx"
|
2019-11-24 02:10:55 +01:00
|
|
|
notify: "(Handler: All OSs) Start NGINX"
|