35 lines
786 B
YAML
35 lines
786 B
YAML
---
|
|
- name: Instalar Nginx
|
|
ansible.builtin.dnf:
|
|
name: nginx
|
|
state: present
|
|
|
|
- name: Retirar virtual host predeterminado si existe
|
|
ansible.builtin.file:
|
|
path: /etc/nginx/conf.d/default.conf
|
|
state: absent
|
|
notify: Recargar Nginx
|
|
|
|
- name: Configurar Nginx y proxy del portal
|
|
ansible.builtin.template:
|
|
src: '{{ item }}.j2'
|
|
dest: '/etc/nginx/{{ item }}'
|
|
owner: root
|
|
group: root
|
|
mode: '0644'
|
|
loop:
|
|
- nginx.conf
|
|
- conf.d/tesis-portal.conf
|
|
notify: Recargar Nginx
|
|
|
|
- name: Validar configuracion antes de iniciar Nginx
|
|
ansible.builtin.command: /usr/sbin/nginx -t
|
|
changed_when: false
|
|
when: not ansible_check_mode
|
|
|
|
- name: Habilitar e iniciar Nginx
|
|
ansible.builtin.systemd_service:
|
|
name: nginx
|
|
enabled: true
|
|
state: started
|