ansible-role-nginx/molecule/default/converge.yml

48 lines
1.5 KiB
YAML
Raw Permalink Normal View History

---
- name: Converge
hosts: all
pre_tasks:
2020-08-19 18:39:17 +02:00
- name: Set repo if Alpine
set_fact:
version: "=1.19.8-r1"
2020-09-15 21:27:06 +02:00
when: ansible_facts['os_family'] == "Alpine"
2020-08-19 18:39:17 +02:00
- name: Set repo if Debian
set_fact:
version: "=1.19.8-1~{{ ansible_facts['distribution_release'] }}"
2020-09-15 21:27:06 +02:00
when: ansible_facts['os_family'] == "Debian"
- name: Set repo if Red Hat
set_fact:
version: "-1.19.8-1.el{{ ansible_facts['distribution_major_version'] }}.ngx"
2020-09-15 21:27:06 +02:00
when: ansible_facts['os_family'] == "RedHat"
2020-08-19 18:39:17 +02:00
- 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'
2020-09-15 21:27:06 +02:00
when: ansible_facts['os_family'] == "RedHat" and ansible_facts['distribution_major_version'] is version('8', '==')
2020-08-19 18:39:17 +02:00
tasks:
- name: Install NGINX
include_role:
name: ansible-role-nginx
vars:
nginx_debug_output: true
nginx_selinux: true
nginx_selinux_tcp_ports:
- 80
- 443
nginx_version: "{{ version }}"
nginx_configure: false
nginx_logrotate_conf_enable: true
nginx_logrotate_conf:
paths:
2020-09-19 17:32:17 +02:00
- /var/log/nginx/*.log
2020-08-19 18:39:17 +02:00
options:
- daily
- missingok
- rotate 14
- compress
- delaycompress
- notifempty
- sharedscripts