March 2019
Intermediate to advanced
412 pages
9h 49m
English
Handlers are essentially tasks. They're a set of potential tasks triggered by way of notifications from other tasks. As such, handler tasks can be included just as regular tasks can. The include operator is legal within the handlers block.
Unlike with task inclusions, variable data cannot be passed along when including handler tasks. However, it is possible to attach a conditional to a handler inclusion, to apply the conditional to every handler within the file.
Let's create an example to demonstrate this. First, we'll create a playbook that has a task that will always change, and that includes a handler task file and attaches a conditional to that inclusion:
--- - name: touch files hosts: localhost gather_facts: false ...
Read now
Unlock full access