-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from codecounselor/master
Made role idempotent
- Loading branch information
Showing
5 changed files
with
36 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,21 @@ | ||
--- | ||
# The order here matters | ||
- name: restart telegraf | ||
service: | ||
service: | ||
name: telegraf | ||
state: restarted | ||
|
||
- name: pause | ||
pause: | ||
seconds: 3 | ||
seconds: "{{telegraf_start_delay}}" | ||
|
||
## 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 | ||
ignore_errors: yes | ||
register: telegraf_service_status | ||
- name: assert running | ||
assert: | ||
that: | ||
- "telegraf_service_status.rc == 0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
- name: Start the Telegraf service | ||
service: | ||
name: telegraf | ||
state: started | ||
enabled: yes | ||
# Only care to check the status if the state changed to 'started' | ||
notify: | ||
- "pause" | ||
- "check status" | ||
- "assert running" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters