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