Add CentOS/RedHat yum repository module_hotfixes option (#264)

This commit is contained in:
heronimus 2020-06-18 19:34:51 +07:00 committed by GitHub
parent f76441f5d4
commit 088a33b33a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 1 deletions

View File

@ -14,6 +14,13 @@
set_fact: set_fact:
version: "-1.17.10-1.el{{ ansible_distribution_major_version }}.ngx" version: "-1.17.10-1.el{{ ansible_distribution_major_version }}.ngx"
when: ansible_os_family == "RedHat" when: ansible_os_family == "RedHat"
- name: "Enable Nginx @CentOS-AppStream dnf modules"
shell:
args:
cmd: dnf module info nginx | grep -q 'Stream.*\[e\]' && echo -n ENABLED || dnf module enable -y nginx # noqa 204 303
register: dnf_module_enable
changed_when: dnf_module_enable.stdout != 'ENABLED'
when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "8"
roles: roles:
- role: ansible-role-nginx - role: ansible-role-nginx
vars: vars:

View File

@ -10,13 +10,27 @@
set_fact: set_fact:
repository: "{{ nginx_repository | default(default_repository) }}" repository: "{{ nginx_repository | default(default_repository) }}"
- name: "(Install: CentOS/RedHat) Add NGINX Repository" - name: "(Install: CentOS/RedHat) Add NGINX Repository for CentOS/RHEL 6/7"
yum_repository: yum_repository:
name: nginx name: nginx
baseurl: "{{ repository }}" baseurl: "{{ repository }}"
description: NGINX Repository description: NGINX Repository
enabled: yes enabled: yes
gpgcheck: yes gpgcheck: yes
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"
- name: "(Install: CentOS/RedHat) Install Required CentOS/RedHat Dependencies" - name: "(Install: CentOS/RedHat) Install Required CentOS/RedHat Dependencies"
yum: yum: