Make timedatectl calls more robust
This commit is contained in:
parent
89a27120e9
commit
cbd11ab12b
|
@ -1,9 +1,16 @@
|
|||
---
|
||||
- name: See if NTProtocol active
|
||||
shell: 'timedatectl | grep "NTP synchronized:" | cut -d: -f 2 | grep -o "yes\|no"'
|
||||
shell: 'timedatectl | grep "\(NTP service\|NTP enabled\|Network time on\):" | cut -d: -f 2 | grep -o "active\|inactive\|yes\|no\|n/a"'
|
||||
ignore_errors: True
|
||||
register: timedatectl
|
||||
|
||||
|
||||
- name: 'Fail if "timedatectl" could not be executed"'
|
||||
fail:
|
||||
msg: 'Could not execute "timedatectl", give up....'
|
||||
when: timedatectl is failed
|
||||
|
||||
|
||||
- name: Template configuration
|
||||
template:
|
||||
src: etc/systemd/timesyncd.conf.j2
|
||||
|
|
Loading…
Reference in a new issue