14 lines
425 B
YAML
14 lines
425 B
YAML
|
- name: schedule restart randomly between 2-5 AM if necessary
|
||
|
shell: |
|
||
|
hour=$(shuf -i 2-5 -n 1)
|
||
|
minute=$(shuf -i 0-59 -n 1)
|
||
|
shutdown -r "$hour:$minute"
|
||
|
echo "restart scheduled for $hour:$minute"
|
||
|
when: restart_needed.stdout_lines | length > 0
|
||
|
register: restard_scheduled
|
||
|
|
||
|
- name: output "restart schedule"
|
||
|
debug:
|
||
|
var: restard_scheduled.stdout_lines
|
||
|
when: restart_needed.stdout_lines | length > 0
|