31 lines
675 B
YAML
31 lines
675 B
YAML
|
---
|
||
|
# 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
|