Handlers are used to trigger actions when the tasks are executed. For example, in the case of being required to start some service after an installation then a handler to restart the service could be called. Following an example.
--- - name: Handler exemple hosts: all tasks: - name: Copy content copy: content: "Copy content to the index.html file" dest: /var/www/html/index.html notify: - restart_service handlers: - name: restart_service service: name: mongodb state: restarted
NOTE: The notify attribute is used to call the handler and the handlers are called by the name.
For further information see the Intro to Playbooks documentation.