* Explicitly define `mode` in relevant tasks. * Explicitly define the `nginx` `apt_repository` filename in Debian based distros. * Building OpenSSL from source should now work properly in CentOS 8.
48 lines
1.4 KiB
YAML
48 lines
1.4 KiB
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 for CentOS/RHEL 6/7"
|
|
yum_repository:
|
|
name: nginx
|
|
baseurl: "{{ repository }}"
|
|
description: NGINX Repository
|
|
enabled: yes
|
|
gpgcheck: yes
|
|
mode: 0644
|
|
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: yes
|
|
block: |
|
|
[nginx]
|
|
baseurl = {{ repository }}
|
|
enabled = 1
|
|
gpgcheck = 1
|
|
name = NGINX Repository
|
|
module_hotfixes = true
|
|
mode: 0644
|
|
when: ansible_distribution_major_version == "8"
|
|
|
|
- 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"
|