Added new hosts
This commit is contained in:
38
training/practica-3-jinja2/apache2/README.md
Normal file
38
training/practica-3-jinja2/apache2/README.md
Normal file
@@ -0,0 +1,38 @@
|
||||
Role Name
|
||||
=========
|
||||
|
||||
A brief description of the role goes here.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||
|
||||
- hosts: servers
|
||||
roles:
|
||||
- { role: username.rolename, x: 42 }
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
BSD
|
||||
|
||||
Author Information
|
||||
------------------
|
||||
|
||||
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
|
||||
3
training/practica-3-jinja2/apache2/defaults/main.yml
Normal file
3
training/practica-3-jinja2/apache2/defaults/main.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
---
|
||||
# defaults file for apache2
|
||||
16
training/practica-3-jinja2/apache2/files/hosts.conf
Normal file
16
training/practica-3-jinja2/apache2/files/hosts.conf
Normal file
@@ -0,0 +1,16 @@
|
||||
<VirtualHost *:80>
|
||||
ServerAdmin webmaster@exemple.com
|
||||
ServerName exemple.com
|
||||
ServerAlias www.exemple.com
|
||||
|
||||
DocumentRoot /var/www/exemple.com/public_html
|
||||
|
||||
ErrorLog ${APACHE_LOG_DIR}/exemple.com_error.log
|
||||
CustomLog ${APACHE_LOG_DIR}/exemple.com_access.log combined
|
||||
|
||||
<Directory /var/www/exemple.com/public_html>
|
||||
Options Indexes FollowSymLinks
|
||||
AllowOverride All
|
||||
Require all granted
|
||||
</Directory>
|
||||
</VirtualHost>
|
||||
10
training/practica-3-jinja2/apache2/handlers/main.yml
Normal file
10
training/practica-3-jinja2/apache2/handlers/main.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
---
|
||||
# handlers file for apache2
|
||||
#Notifica a la tarea de reinicio de Apache2 si este archivo cambia
|
||||
- name: Reiniciar Apache2
|
||||
ansible.builtin.service:
|
||||
name: apache2 #Nombre del servicio a reiniciar
|
||||
state: restarted #Reinicia el servicio
|
||||
when: ansible_facts.services['apache2.service'].state == 'running' #Solo si el servicio está corriendo
|
||||
#when: ansible_facts.services['apache2'].state == 'running' #Condición para versiones antiguas
|
||||
35
training/practica-3-jinja2/apache2/meta/main.yml
Normal file
35
training/practica-3-jinja2/apache2/meta/main.yml
Normal file
@@ -0,0 +1,35 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
galaxy_info:
|
||||
author: your name
|
||||
description: your role description
|
||||
company: your company (optional)
|
||||
|
||||
# If the issue tracker for your role is not on github, uncomment the
|
||||
# next line and provide a value
|
||||
# issue_tracker_url: http://example.com/issue/tracker
|
||||
|
||||
# Choose a valid license ID from https://spdx.org - some suggested licenses:
|
||||
# - BSD-3-Clause (default)
|
||||
# - MIT
|
||||
# - GPL-2.0-or-later
|
||||
# - GPL-3.0-only
|
||||
# - Apache-2.0
|
||||
# - CC-BY-4.0
|
||||
license: license (GPL-2.0-or-later, MIT, etc)
|
||||
|
||||
min_ansible_version: 2.1
|
||||
|
||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||
# min_ansible_container_version:
|
||||
|
||||
galaxy_tags: []
|
||||
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||
# remove the '[]' above, if you add tags to this list.
|
||||
#
|
||||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||
# Maximum 20 tags per role.
|
||||
|
||||
dependencies: []
|
||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||
# if you add dependencies to this list.
|
||||
32
training/practica-3-jinja2/apache2/tasks/main.yml
Normal file
32
training/practica-3-jinja2/apache2/tasks/main.yml
Normal file
@@ -0,0 +1,32 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
---
|
||||
# tasks file for apache2
|
||||
#Instalar un servidor web (Apache2).
|
||||
- name: Instalación de Apache2
|
||||
ansible.builtin.package:
|
||||
name: "{{ item }}" #Nombre del paquete a instalar
|
||||
state: present #Asegura que el paquete esté instalado
|
||||
with_items: #Itera sobre una lista de paquetes
|
||||
- apache2 #Servidor web Apache
|
||||
- apache2-utils #Utilidades de Apache
|
||||
- libapache2-mod-php #Módulo de PHP para Apache
|
||||
- apache2-suexec-custom #Módulo de Apache para ejecutar scripts con permisos de usuario personalizado
|
||||
- apache2-suexec-pristine #Módulo de Apache para ejecutar scripts con permisos de usuario prístino
|
||||
|
||||
#Asegurar de que el servicio de Apache2 està corriendo y habilitado.
|
||||
- name: Asegurar que Apache2 está corriendo
|
||||
ansible.builtin.service:
|
||||
name: apache2 #Nombre del servicio a gestionar
|
||||
state: started #Asegura que el servicio esté en ejecución
|
||||
enabled: yes #Habilita el servicio para que se inicie al arrancar el sistema
|
||||
|
||||
#Copia el archivo de configuración hosts de Apache2 al directorio correspondiente
|
||||
- name: Copiar archivo de configuración de hosts de Apache2
|
||||
ansible.builtin.copy:
|
||||
src: ../files/hosts.conf #Ruta al archivo de configuración local
|
||||
dest: /etc/apache2/sites-available/000-default.conf #Ruta de destino en el servidor
|
||||
owner: www-data #Propietario del archivo
|
||||
group: www-data #Grupo del archivo
|
||||
mode: '0644' #Permisos del archivo
|
||||
notify:
|
||||
- Reiniciar Apache2 #Notifica a la tarea de reinicio de Apache2 si este archivo cambia
|
||||
3
training/practica-3-jinja2/apache2/tests/inventory
Normal file
3
training/practica-3-jinja2/apache2/tests/inventory
Normal file
@@ -0,0 +1,3 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
localhost
|
||||
|
||||
6
training/practica-3-jinja2/apache2/tests/test.yml
Normal file
6
training/practica-3-jinja2/apache2/tests/test.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
---
|
||||
- hosts: localhost
|
||||
remote_user: root
|
||||
roles:
|
||||
- apache2
|
||||
3
training/practica-3-jinja2/apache2/vars/main.yml
Normal file
3
training/practica-3-jinja2/apache2/vars/main.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
---
|
||||
# vars file for apache2
|
||||
8
training/practica-3-jinja2/inventory
Normal file
8
training/practica-3-jinja2/inventory
Normal file
@@ -0,0 +1,8 @@
|
||||
[database]
|
||||
192.168.11.20
|
||||
|
||||
[loadbalancer]
|
||||
192.168.11.30
|
||||
|
||||
[webserver]
|
||||
192.168.11.40
|
||||
14
training/practica-3-jinja2/main.yml
Normal file
14
training/practica-3-jinja2/main.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
- become: yes
|
||||
hosts: webserver
|
||||
roles:
|
||||
- role: apache2
|
||||
- role: php
|
||||
|
||||
hosts: database
|
||||
roles:
|
||||
- role: mariadb
|
||||
|
||||
hosts: loadbalancer
|
||||
roles:
|
||||
- role: nginx
|
||||
- role: users
|
||||
38
training/practica-3-jinja2/mariadb/README.md
Normal file
38
training/practica-3-jinja2/mariadb/README.md
Normal file
@@ -0,0 +1,38 @@
|
||||
Role Name
|
||||
=========
|
||||
|
||||
A brief description of the role goes here.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||
|
||||
- hosts: servers
|
||||
roles:
|
||||
- { role: username.rolename, x: 42 }
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
BSD
|
||||
|
||||
Author Information
|
||||
------------------
|
||||
|
||||
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
|
||||
3
training/practica-3-jinja2/mariadb/defaults/main.yml
Normal file
3
training/practica-3-jinja2/mariadb/defaults/main.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
---
|
||||
# defaults file for mariadb
|
||||
3
training/practica-3-jinja2/mariadb/handlers/main.yml
Normal file
3
training/practica-3-jinja2/mariadb/handlers/main.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
---
|
||||
# handlers file for mariadb
|
||||
35
training/practica-3-jinja2/mariadb/meta/main.yml
Normal file
35
training/practica-3-jinja2/mariadb/meta/main.yml
Normal file
@@ -0,0 +1,35 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
galaxy_info:
|
||||
author: your name
|
||||
description: your role description
|
||||
company: your company (optional)
|
||||
|
||||
# If the issue tracker for your role is not on github, uncomment the
|
||||
# next line and provide a value
|
||||
# issue_tracker_url: http://example.com/issue/tracker
|
||||
|
||||
# Choose a valid license ID from https://spdx.org - some suggested licenses:
|
||||
# - BSD-3-Clause (default)
|
||||
# - MIT
|
||||
# - GPL-2.0-or-later
|
||||
# - GPL-3.0-only
|
||||
# - Apache-2.0
|
||||
# - CC-BY-4.0
|
||||
license: license (GPL-2.0-or-later, MIT, etc)
|
||||
|
||||
min_ansible_version: 2.1
|
||||
|
||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||
# min_ansible_container_version:
|
||||
|
||||
galaxy_tags: []
|
||||
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||
# remove the '[]' above, if you add tags to this list.
|
||||
#
|
||||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||
# Maximum 20 tags per role.
|
||||
|
||||
dependencies: []
|
||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||
# if you add dependencies to this list.
|
||||
11
training/practica-3-jinja2/mariadb/tasks/main.yml
Normal file
11
training/practica-3-jinja2/mariadb/tasks/main.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
---
|
||||
# tasks file for mariadb
|
||||
#Instalar un servidor web (Apache2).
|
||||
- name: Instalación de MariaDB
|
||||
ansible.builtin.package:
|
||||
name: "{{ item }}" #Nombre del paquete a instalar
|
||||
state: present #Asegura que el paquete esté instalado
|
||||
with_items: #Itera sobre una lista de paquetes
|
||||
- mariadb-client #Cliente de base de datos MariaDB
|
||||
- mariadb-server #Servidor de base de datos MariaDB
|
||||
3
training/practica-3-jinja2/mariadb/tests/inventory
Normal file
3
training/practica-3-jinja2/mariadb/tests/inventory
Normal file
@@ -0,0 +1,3 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
localhost
|
||||
|
||||
6
training/practica-3-jinja2/mariadb/tests/test.yml
Normal file
6
training/practica-3-jinja2/mariadb/tests/test.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
---
|
||||
- hosts: localhost
|
||||
remote_user: root
|
||||
roles:
|
||||
- mariadb
|
||||
3
training/practica-3-jinja2/mariadb/vars/main.yml
Normal file
3
training/practica-3-jinja2/mariadb/vars/main.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
---
|
||||
# vars file for mariadb
|
||||
38
training/practica-3-jinja2/nginx/README.md
Normal file
38
training/practica-3-jinja2/nginx/README.md
Normal file
@@ -0,0 +1,38 @@
|
||||
Role Name
|
||||
=========
|
||||
|
||||
A brief description of the role goes here.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||
|
||||
- hosts: servers
|
||||
roles:
|
||||
- { role: username.rolename, x: 42 }
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
BSD
|
||||
|
||||
Author Information
|
||||
------------------
|
||||
|
||||
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
|
||||
3
training/practica-3-jinja2/nginx/defaults/main.yml
Normal file
3
training/practica-3-jinja2/nginx/defaults/main.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
---
|
||||
# defaults file for nginx
|
||||
56
training/practica-3-jinja2/nginx/files/nginx.conf
Normal file
56
training/practica-3-jinja2/nginx/files/nginx.conf
Normal file
@@ -0,0 +1,56 @@
|
||||
# Archivo de configuración nginx.conf
|
||||
|
||||
user www-data;
|
||||
worker_processes auto;
|
||||
pid /run/nginx.pid;
|
||||
include /etc/nginx/modules-enabled/*.conf;
|
||||
|
||||
events {
|
||||
worker_connections 768;
|
||||
# multi_accept on;
|
||||
}
|
||||
|
||||
http {
|
||||
|
||||
##
|
||||
# Configuración básica
|
||||
##
|
||||
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
keepalive_timeout 65;
|
||||
types_hash_max_size 2048;
|
||||
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
##
|
||||
# Configuración de logs
|
||||
##
|
||||
|
||||
access_log /var/log/nginx/access.log;
|
||||
error_log /var/log/nginx/error.log;
|
||||
|
||||
##
|
||||
# Gzip settings
|
||||
##
|
||||
|
||||
gzip on;
|
||||
gzip_disable "msie6";
|
||||
|
||||
# Configuración de virtual host
|
||||
server {
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server;
|
||||
|
||||
root /var/www/html;
|
||||
index index.html index.htm index.nginx-debian.html;
|
||||
|
||||
server_name _;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
}
|
||||
}
|
||||
9
training/practica-3-jinja2/nginx/handlers/main.yml
Normal file
9
training/practica-3-jinja2/nginx/handlers/main.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
---
|
||||
# handlers file for nginx
|
||||
- name: Reiniciar Nginx
|
||||
ansible.builtin.service:
|
||||
name: nginx #Nombre del servicio a reiniciar
|
||||
state: restarted #Reinicia el servicio
|
||||
when: ansible_facts.services['nginx.service'].state == 'running' #Solo si el servicio está corriendo
|
||||
#when: ansible_facts.services['nginx'].state == 'running' #Condición para versiones antiguas
|
||||
35
training/practica-3-jinja2/nginx/meta/main.yml
Normal file
35
training/practica-3-jinja2/nginx/meta/main.yml
Normal file
@@ -0,0 +1,35 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
galaxy_info:
|
||||
author: your name
|
||||
description: your role description
|
||||
company: your company (optional)
|
||||
|
||||
# If the issue tracker for your role is not on github, uncomment the
|
||||
# next line and provide a value
|
||||
# issue_tracker_url: http://example.com/issue/tracker
|
||||
|
||||
# Choose a valid license ID from https://spdx.org - some suggested licenses:
|
||||
# - BSD-3-Clause (default)
|
||||
# - MIT
|
||||
# - GPL-2.0-or-later
|
||||
# - GPL-3.0-only
|
||||
# - Apache-2.0
|
||||
# - CC-BY-4.0
|
||||
license: license (GPL-2.0-or-later, MIT, etc)
|
||||
|
||||
min_ansible_version: 2.1
|
||||
|
||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||
# min_ansible_container_version:
|
||||
|
||||
galaxy_tags: []
|
||||
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||
# remove the '[]' above, if you add tags to this list.
|
||||
#
|
||||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||
# Maximum 20 tags per role.
|
||||
|
||||
dependencies: []
|
||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||
# if you add dependencies to this list.
|
||||
46
training/practica-3-jinja2/nginx/tasks/main.yml
Normal file
46
training/practica-3-jinja2/nginx/tasks/main.yml
Normal file
@@ -0,0 +1,46 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
---
|
||||
# tasks file for nginx
|
||||
# Asegurar que Apache2 está detenido antes de instalar Nginx
|
||||
- name: Asegurar que Apache2 está detenido
|
||||
ansible.builtin.service:
|
||||
name: apache2 #Nombre del servicio a gestionar
|
||||
state: stopped #Asegura que el servicio esté detenido
|
||||
|
||||
#Instalar un servidor web (Nginx).
|
||||
- name: Instalación de Nginx
|
||||
ansible.builtin.package:
|
||||
name: "{{ item }}" #Nombre del paquete a instalar
|
||||
state: present #Asegura que el paquete esté instalado
|
||||
with_items: #Itera sobre una lista de paquetes
|
||||
- nginx #Servidor web Nginx
|
||||
- nginx-extras #Paquete adicional de Nginx con características extra
|
||||
|
||||
#Asegurar de que el servicio de Nginx està corriendo y habilitado.
|
||||
- name: Asegurar que Nginx está corriendo
|
||||
ansible.builtin.service:
|
||||
name: nginx #Nombre del servicio a gestionar
|
||||
state: started #Asegura que el servicio esté en ejecución
|
||||
enabled: yes #Habilita el servicio para que se inicie al arrancar el sistema
|
||||
|
||||
#Copia el archivo de configuración hosts de Nginx al directorio correspondiente
|
||||
- name: Copiar archivo de configuración de hosts de Nginx
|
||||
ansible.builtin.copy:
|
||||
src: ../files/nginx.conf #Ruta al archivo de configuración local
|
||||
dest: /etc/nginx/sites-available/default #Ruta de destino en el servidor
|
||||
owner: www-data #Propietario del archivo
|
||||
group: www-data #Grupo del archivo
|
||||
mode: '0644' #Permisos del archivo
|
||||
notify:
|
||||
- Reiniciar Nginx #Notifica a la tarea de reinicio de Nginx si este archivo cambia
|
||||
|
||||
#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 antiguas para detener Nginx solo si está corriendo
|
||||
#when: ansible_facts.services['nginx'].state == 'running'
|
||||
3
training/practica-3-jinja2/nginx/tests/inventory
Normal file
3
training/practica-3-jinja2/nginx/tests/inventory
Normal file
@@ -0,0 +1,3 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
localhost
|
||||
|
||||
6
training/practica-3-jinja2/nginx/tests/test.yml
Normal file
6
training/practica-3-jinja2/nginx/tests/test.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
---
|
||||
- hosts: localhost
|
||||
remote_user: root
|
||||
roles:
|
||||
- nginx
|
||||
3
training/practica-3-jinja2/nginx/vars/main.yml
Normal file
3
training/practica-3-jinja2/nginx/vars/main.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
---
|
||||
# vars file for nginx
|
||||
38
training/practica-3-jinja2/php/README.md
Normal file
38
training/practica-3-jinja2/php/README.md
Normal file
@@ -0,0 +1,38 @@
|
||||
Role Name
|
||||
=========
|
||||
|
||||
A brief description of the role goes here.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||
|
||||
- hosts: servers
|
||||
roles:
|
||||
- { role: username.rolename, x: 42 }
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
BSD
|
||||
|
||||
Author Information
|
||||
------------------
|
||||
|
||||
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
|
||||
3
training/practica-3-jinja2/php/defaults/main.yml
Normal file
3
training/practica-3-jinja2/php/defaults/main.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
---
|
||||
# defaults file for php
|
||||
3
training/practica-3-jinja2/php/handlers/main.yml
Normal file
3
training/practica-3-jinja2/php/handlers/main.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
---
|
||||
# handlers file for php
|
||||
35
training/practica-3-jinja2/php/meta/main.yml
Normal file
35
training/practica-3-jinja2/php/meta/main.yml
Normal file
@@ -0,0 +1,35 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
galaxy_info:
|
||||
author: your name
|
||||
description: your role description
|
||||
company: your company (optional)
|
||||
|
||||
# If the issue tracker for your role is not on github, uncomment the
|
||||
# next line and provide a value
|
||||
# issue_tracker_url: http://example.com/issue/tracker
|
||||
|
||||
# Choose a valid license ID from https://spdx.org - some suggested licenses:
|
||||
# - BSD-3-Clause (default)
|
||||
# - MIT
|
||||
# - GPL-2.0-or-later
|
||||
# - GPL-3.0-only
|
||||
# - Apache-2.0
|
||||
# - CC-BY-4.0
|
||||
license: license (GPL-2.0-or-later, MIT, etc)
|
||||
|
||||
min_ansible_version: 2.1
|
||||
|
||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||
# min_ansible_container_version:
|
||||
|
||||
galaxy_tags: []
|
||||
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||
# remove the '[]' above, if you add tags to this list.
|
||||
#
|
||||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||
# Maximum 20 tags per role.
|
||||
|
||||
dependencies: []
|
||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||
# if you add dependencies to this list.
|
||||
31
training/practica-3-jinja2/php/tasks/main.yml
Normal file
31
training/practica-3-jinja2/php/tasks/main.yml
Normal file
@@ -0,0 +1,31 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
---
|
||||
# tasks file for php
|
||||
#Instalar PHP
|
||||
- name: Instalación de PHP
|
||||
ansible.builtin.package:
|
||||
name: "{{ item }}" #Nombre del paquete a instalar
|
||||
state: present #Asegura que el paquete esté instalado
|
||||
with_items: #Itera sobre una lista de paquetes
|
||||
- php #Paquete PHP
|
||||
- php-curl #Extensión PHP para cURL
|
||||
- php-gd #Extensión PHP para gráficos y manipulación de imágenes
|
||||
- php-mbstring #Extensión PHP para manejo de cadenas multibyte
|
||||
- php-memcached #Extensión PHP para Memcached
|
||||
- php-mysql #Extensión PHP para MySQL
|
||||
- php-tcpdf #Extensión PHP para TCPDF
|
||||
- php-xml #Extensión PHP para XML
|
||||
- php-zip #Extensión PHP para manejo de archivos ZIP
|
||||
notify:
|
||||
- Reiniciar Apache2 #Notifica a la tarea de reinicio de Apache2
|
||||
|
||||
#Ver si PHP está instalado correctamente
|
||||
- name: Verificar la instalación de PHP
|
||||
ansible.builtin.command: php -v
|
||||
register: php_version_output
|
||||
changed_when: false
|
||||
|
||||
# Mostrar la versión de PHP instalada
|
||||
- name: Mostrar la versión de PHP instalada
|
||||
ansible.builtin.debug:
|
||||
msg: "Versión de PHP instalada: {{ php_version_output.stdout }}"
|
||||
3
training/practica-3-jinja2/php/tests/inventory
Normal file
3
training/practica-3-jinja2/php/tests/inventory
Normal file
@@ -0,0 +1,3 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
localhost
|
||||
|
||||
6
training/practica-3-jinja2/php/tests/test.yml
Normal file
6
training/practica-3-jinja2/php/tests/test.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
---
|
||||
- hosts: localhost
|
||||
remote_user: root
|
||||
roles:
|
||||
- php
|
||||
3
training/practica-3-jinja2/php/vars/main.yml
Normal file
3
training/practica-3-jinja2/php/vars/main.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
---
|
||||
# vars file for php
|
||||
38
training/practica-3-jinja2/users/README.md
Normal file
38
training/practica-3-jinja2/users/README.md
Normal file
@@ -0,0 +1,38 @@
|
||||
Role Name
|
||||
=========
|
||||
|
||||
A brief description of the role goes here.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||
|
||||
- hosts: servers
|
||||
roles:
|
||||
- { role: username.rolename, x: 42 }
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
BSD
|
||||
|
||||
Author Information
|
||||
------------------
|
||||
|
||||
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
|
||||
3
training/practica-3-jinja2/users/defaults/main.yml
Normal file
3
training/practica-3-jinja2/users/defaults/main.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
---
|
||||
# defaults file for users
|
||||
3
training/practica-3-jinja2/users/handlers/main.yml
Normal file
3
training/practica-3-jinja2/users/handlers/main.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
---
|
||||
# handlers file for users
|
||||
35
training/practica-3-jinja2/users/meta/main.yml
Normal file
35
training/practica-3-jinja2/users/meta/main.yml
Normal file
@@ -0,0 +1,35 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
galaxy_info:
|
||||
author: your name
|
||||
description: your role description
|
||||
company: your company (optional)
|
||||
|
||||
# If the issue tracker for your role is not on github, uncomment the
|
||||
# next line and provide a value
|
||||
# issue_tracker_url: http://example.com/issue/tracker
|
||||
|
||||
# Choose a valid license ID from https://spdx.org - some suggested licenses:
|
||||
# - BSD-3-Clause (default)
|
||||
# - MIT
|
||||
# - GPL-2.0-or-later
|
||||
# - GPL-3.0-only
|
||||
# - Apache-2.0
|
||||
# - CC-BY-4.0
|
||||
license: license (GPL-2.0-or-later, MIT, etc)
|
||||
|
||||
min_ansible_version: 2.1
|
||||
|
||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||
# min_ansible_container_version:
|
||||
|
||||
galaxy_tags: []
|
||||
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||
# remove the '[]' above, if you add tags to this list.
|
||||
#
|
||||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||
# Maximum 20 tags per role.
|
||||
|
||||
dependencies: []
|
||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||
# if you add dependencies to this list.
|
||||
13
training/practica-3-jinja2/users/tasks/main.yml
Normal file
13
training/practica-3-jinja2/users/tasks/main.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
---
|
||||
# tasks file for users
|
||||
- name: Generar hash de la contraseña en el controlador (local)
|
||||
ansible.builtin.set_fact:
|
||||
hashed_password: "{{ user_password | password_hash('sha512') }}"
|
||||
|
||||
- name: Crear usuarios con contraseña
|
||||
ansible.builtin.user:
|
||||
name: "{{ item }}"
|
||||
password: "{{ hashed_password }}"
|
||||
state: present
|
||||
loop: "{{ user_list }}"
|
||||
3
training/practica-3-jinja2/users/tests/inventory
Normal file
3
training/practica-3-jinja2/users/tests/inventory
Normal file
@@ -0,0 +1,3 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
localhost
|
||||
|
||||
6
training/practica-3-jinja2/users/tests/test.yml
Normal file
6
training/practica-3-jinja2/users/tests/test.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
---
|
||||
- hosts: localhost
|
||||
remote_user: root
|
||||
roles:
|
||||
- users
|
||||
8
training/practica-3-jinja2/users/vars/main.yml
Normal file
8
training/practica-3-jinja2/users/vars/main.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
---
|
||||
# vars file for users
|
||||
user_list:
|
||||
- user1
|
||||
- user2
|
||||
- user3
|
||||
user_password: "password" # Contraseña en texto plano
|
||||
Reference in New Issue
Block a user