ansible-role-nginx/tasks/opensource/setup-redhat.yml
2019-12-06 16:48:15 -08:00

32 lines
1006 B
YAML

---
- 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) }}"
- name: "(Install: CentOS/RedHat) Add NGINX Repository"
yum_repository:
name: nginx
baseurl: "{{ repository }}"
description: NGINX Repository
enabled: yes
gpgcheck: yes
- name: "(Install: CentOS/RedHat) Install Required CentOS/RedHat Dependencies"
yum:
name: openssl
- name: "(Install: CentOS/RedHat) Install NGINX"
yum:
name: "nginx{{ nginx_version | default('') }}"
state: "{{ nginx_state }}"
disablerepo: "*"
enablerepo: "nginx"
notify: "(Handler: All OSs) Start NGINX"