diff --git a/src/ops/tools/ansible.md b/src/ops/tools/ansible.md index 7e9fadd..3f8d771 100644 --- a/src/ops/tools/ansible.md +++ b/src/ops/tools/ansible.md @@ -49,4 +49,18 @@ import_tasks. ``` `ìnclude_tasks` will add all tasks to play run, even if the when condition is -false. \ No newline at end of file +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" +``` \ No newline at end of file