Last active
March 1, 2021 18:36
-
-
Save chrismeyersfsu/e2f60d96e53c821091fac0babaa69239 to your computer and use it in GitHub Desktop.
Randomly sleep
This file contains hidden or 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
--- | |
- hosts: all | |
gather_facts: false | |
vars: | |
sleep_time: 120 | |
tasks: | |
- name: sleep | |
shell: sleep {{ sleep_time }} |
This file contains hidden or 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
--- | |
- hosts: all | |
gather_facts: false | |
vars: | |
sleep_min: 120 | |
sleep_max: 150 | |
tasks: | |
- name: decide sleep time | |
command: shuf -i {{ sleep_min }}-{{ sleep_max }} -n1 | |
register: result | |
- name: save sleep time | |
set_fact: | |
sleep_seconds: "{{ result.stdout_lines[0] }}" | |
- name: output sleep time | |
debug: | |
msg: "will sleep for {{ sleep_seconds }} seconds" | |
- name: save sleep time to artifact data | |
set_stats: | |
data: | |
sleep_seconds_value: "{{ sleep_seconds }}" | |
- name: sleep | |
command: sleep {{ sleep_seconds }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment