ansible/roles/telegraf/handlers/main.yml

31 lines
675 B
YAML
Raw Normal View History

2021-01-10 19:11:32 +01:00
---
# The order here matters
- name: restart telegraf
service:
name: telegraf
state: restarted
become: true
when: telegraf_start_service
- name: pause
pause:
seconds: "{{ telegraf_start_delay }}"
when: telegraf_start_service
## After version 2.2 of ansible 'listen' could be used to
## group 'check status' and 'assert running' into a single listener
- name: check status
command: service telegraf status
args:
warn: false
ignore_errors: yes
register: telegraf_service_status
become: true
when: telegraf_start_service
- name: assert running
assert:
that:
- "telegraf_service_status.rc == 0"
when: telegraf_start_service