Fix indentation ()

This commit is contained in:
Ilias Trichopoulos 2020-02-03 18:30:12 +01:00 committed by GitHub
parent ea105dcb2f
commit d6f2b4e788
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -132,14 +132,14 @@ This playbook, ``verify-apache.yml``, contains a single play with variables, the
In the example above, the second task notifies the handler. A single task can notify more than one handler:: In the example above, the second task notifies the handler. A single task can notify more than one handler::
- name: template configuration file - name: template configuration file
template: template:
src: template.j2 src: template.j2
dest: /etc/foo.conf dest: /etc/foo.conf
notify: notify:
- restart memcached - restart memcached
- restart apache - restart apache
handlers: handlers:
- name: restart memcached - name: restart memcached
service: service:
name: memcached name: memcached
@ -157,9 +157,9 @@ By default, handlers run after all the tasks in a particular play have been comp
If you need handlers to run before the end of the play, add a task to flush them using the :ref:`meta module <meta_module>`, which executes Ansible actions:: If you need handlers to run before the end of the play, add a task to flush them using the :ref:`meta module <meta_module>`, which executes Ansible actions::
tasks: tasks:
- shell: some tasks go here - shell: some tasks go here
- meta: flush_handlers - meta: flush_handlers
- shell: some other tasks - shell: some other tasks
The ``meta: flush_handlers`` task triggers any handlers that have been notified at that point in the play. The ``meta: flush_handlers`` task triggers any handlers that have been notified at that point in the play.
@ -191,21 +191,21 @@ Instead, place variables in the task parameters of your handler. You can load th
Handlers can also "listen" to generic topics, and tasks can notify those topics as follows:: Handlers can also "listen" to generic topics, and tasks can notify those topics as follows::
handlers: handlers:
- name: restart memcached - name: restart memcached
service: service:
name: memcached name: memcached
state: restarted state: restarted
listen: "restart web services" listen: "restart web services"
- name: restart apache - name: restart apache
service: service:
name: apache name: apache
state: restarted state: restarted
listen: "restart web services" listen: "restart web services"
tasks: tasks:
- name: restart everything - name: restart everything
command: echo "this task will restart the web services" command: echo "this task will restart the web services"
notify: "restart web services" notify: "restart web services"
This use makes it much easier to trigger multiple handlers. It also decouples handlers from their names, This use makes it much easier to trigger multiple handlers. It also decouples handlers from their names,
making it easier to share handlers among playbooks and roles (especially when using 3rd party roles from making it easier to share handlers among playbooks and roles (especially when using 3rd party roles from