Ansible-Roles/roles/nginx/tasks/nginx-rh.yml
2026-05-08 22:12:36 +03:00

38 lines
1.2 KiB
YAML

---
- name: Install nginx on Enterprise Linux
when: ansible_distribution_file_variety == "RedHat"
tags: [nginx]
block:
- name: Add a new DNF repository
ansible.builtin.yum_repository:
name: nginx
description: nginx stable repo
baseurl: https://nginx.org/packages/centos/{{ ansible_facts['distribution_major_version'] }}/{{ ansible_architecture }}/
gpgcheck: true
gpgkey: https://nginx.org/keys/nginx_signing.key
enabled: true
- name: Install the nginx web server
ansible.builtin.dnf:
pkg: nginx
state: "{{ nginx_package_state }}"
- name: Nginx must be able to network connect and relay when used as a proxy
ansible.posix.seboolean:
name: httpd_can_network_connect
state: 1
persistent: true
with_items:
- httpd_can_network_connect
- httpd_can_network_relay
when: letsencrypt_acme_install is defined and letsencrypt_acme_install and nginx_selinux is true
tags: [nginx, nginx_selinux]
- name: Give nginx the ability to set RLIMIT_NOFILE
ansible.posix.seboolean:
name: httpd_setrlimit
state: 1
persistent: true
when: nginx_selinux is true
tags: [nginx, nginx_selinux]