Added nginx role

This commit is contained in:
Guillem Hernandez Sola
2025-06-18 10:52:37 +02:00
parent 55e3923991
commit 2cbcad9dfb
3 changed files with 25 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
[database]
192.168.11.20
[loadbalancer]
192.168.11.30
[webserver]
192.168.11.40

View File

@@ -0,0 +1,7 @@
- hosts: all
become: yes
roles:
- role: nginx
- role: apache2
- role: php
- role: mariadb

View File

@@ -1,3 +1,13 @@
#SPDX-License-Identifier: MIT-0 #SPDX-License-Identifier: MIT-0
--- ---
# tasks file for nginx # tasks file for nginx
#Vamos a parar Nginx si está corriendo
- name: Comprueba el estado de Nginx
ansible.builtin.service_facts: #Recopila información sobre los servicios
- name: Detener Nginx si está activo
ansible.builtin.service:
name: nginx
state: stopped
when: ansible_facts.services['nginx.service'].state == 'running'
#Condición para versiones antinguas para detener Nginx solo si está corriendo
#when: ansible_facts.services['nginx'].state == 'running'