Reusing tasks as handlers
You can also use includes and imports in theHandlers: running operations on changesection of a playbook. For example, if you want to define how to restart Apache, you only have to do that once for all of your playbooks. You might make arestarts.ymlfile that looks like:
You can trigger handlers from either an import or an include, but the procedure is different for each method of reuse. If you include the file, you must notify the include itself, which triggers all the tasks inrestarts.yml. If you import the file, you must notify the individual task(s) withinrestarts.yml. You can mix direct tasks and handlers with included or imported tasks and handlers.