Add exec tasks if service found

This commit is contained in:
Wilfried OLLIVIER 2019-06-29 21:27:44 +02:00
parent 087a367572
commit d8335a1ff5

View file

@ -49,4 +49,18 @@ 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"
```