Add exec tasks if service found
This commit is contained in:
parent
087a367572
commit
d8335a1ff5
1 changed files with 15 additions and 1 deletions
|
@ -50,3 +50,17 @@ import_tasks.
|
||||||
|
|
||||||
`ìnclude_tasks` will add all tasks to play run, even if the when condition is
|
`ìnclude_tasks` will add all tasks to play run, even if the when condition is
|
||||||
false.
|
false.
|
||||||
|
|
||||||
|
## Exec task(s) if a specific service is found
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- name: Is Docker running ?
|
||||||
|
service_facts:
|
||||||
|
|
||||||
|
- name: Push Telegraf docker input config if needed
|
||||||
|
template:
|
||||||
|
src: inputs/input.docker.conf.j2
|
||||||
|
dest: /etc/telegraf/telegraf.d/input.docker.conf
|
||||||
|
notify: reload telegraf
|
||||||
|
when: "'docker' in services"
|
||||||
|
```
|
Loading…
Reference in a new issue