From 97b5bd92c6f83b258153d9f9ae1968120247f63f Mon Sep 17 00:00:00 2001 From: Guillem Hernandez Sola Date: Tue, 18 Nov 2025 11:34:14 +0100 Subject: [PATCH] More documentation --- training/handler-nginx.yml | 15 +++++++++++++++ training/import_playbooks.yml | 5 +++++ training/import_tasks.yml | 9 +++++++++ 3 files changed, 29 insertions(+) create mode 100644 training/handler-nginx.yml create mode 100644 training/import_playbooks.yml create mode 100644 training/import_tasks.yml diff --git a/training/handler-nginx.yml b/training/handler-nginx.yml new file mode 100644 index 0000000..61b68cb --- /dev/null +++ b/training/handler-nginx.yml @@ -0,0 +1,15 @@ +- name: Prueba de handlers + hosts: webserver + become: yes + tasks: + - name: Copiar archivo de configuración + copy: + src: nginx.conf + dest: /etc/nginx/nginx.conf + notify: + - Reiniciar Nginx + handlers: + - name: Reiniciar Nginx + service: + name: nginx + state: restarted \ No newline at end of file diff --git a/training/import_playbooks.yml b/training/import_playbooks.yml new file mode 100644 index 0000000..d5df768 --- /dev/null +++ b/training/import_playbooks.yml @@ -0,0 +1,5 @@ +# import_playbook soporta handlers correctamente. +# Por lo tanto, este playbook importa otros playbooks que contienen handlers. +- import_playbook: install-nginx.yml +- import_playbook: handler-nginx.yml +- import_playbook: uninstall-nginx.yml \ No newline at end of file diff --git a/training/import_tasks.yml b/training/import_tasks.yml new file mode 100644 index 0000000..f74c202 --- /dev/null +++ b/training/import_tasks.yml @@ -0,0 +1,9 @@ +# Solo admite tasks y no soporte handlers correctamente. +# Por lo tanto, este playbook importa otros playbooks que contienen solo tasks. +- name: gestiones nginx + hosts: webserver + become: yes + tasks: + - import_task: nginx.yml + - import_task: nginx-handlers.yml + - import_task: uninstall-nginx.yml \ No newline at end of file