Update playbooks/time-region-ntp.yml

This commit is contained in:
2025-11-15 05:09:00 +00:00
parent d6d422d470
commit 114d5632d3
+5 -9
View File
@@ -101,22 +101,18 @@
- ansible_facts['os_family'] == "RedHat" - ansible_facts['os_family'] == "RedHat"
- rocky_add.changed or rocky_cleanup.changed - rocky_add.changed or rocky_cleanup.changed
# ---------------------------------------------------------- # ----------------------------------------------------------
# PRINT TIME & NTP SOURCE # PRINT TIME & NTP SOURCE (ZERO FAILURE SAFE)
# ---------------------------------------------------------- # ----------------------------------------------------------
- name: Read timedatectl status - name: Read timedatectl status
ansible.builtin.command: timedatectl status ansible.builtin.command: timedatectl
register: timedate_output register: timedate_output
- name: Print server time + NTP source - name: Print time + time source for each server
ansible.builtin.debug: ansible.builtin.debug:
msg: | msg: |
=== {{ inventory_hostname }} === === {{ inventory_hostname }} ===
Current Time: {{ timedate_output.stdout | regex_search('Local time:\\s*(.*)', '\\1') }} {{ timedate_output.stdout }}
Timezone: {{ timedate_output.stdout | regex_search('Time zone:\\s*(.*)', '\\1') }}
NTP Source: {{ timedate_output.stdout | regex_search('System clock synchronized:\\s*(.*)', '\\1') }}
NTP Server: {{ timedate_output.stdout | regex_search('NTP service:\\s*(.*)', '\\1') }}
# ---------------------------------------------------------- # ----------------------------------------------------------
# FINAL SUMMARY # FINAL SUMMARY
# ---------------------------------------------------------- # ----------------------------------------------------------