diff --git a/playbooks/check-time-sync.yml b/playbooks/check-time-sync.yml index e69c0a8..d8e9208 100644 --- a/playbooks/check-time-sync.yml +++ b/playbooks/check-time-sync.yml @@ -19,7 +19,14 @@ changed_when: false failed_when: ntp_offset.rc != 0 - - name: Extract and display final offset line + - name: Try to extract final offset line + set_fact: + ntp_offset_summary: "{{ ntp_offset.stdout_lines | select('search', 'adjust time') | list | first | default('No offset line found') }}" + + - name: Show full ntpdate output per host debug: msg: | - [{{ inventory_hostname }}] -> {{ ntp_offset.stdout_lines | select('search', 'adjust time') | list | first | default('No offset reported') }} + [{{ inventory_hostname }}] + Offset summary: {{ ntp_offset_summary }} + Raw output: + {{ ntp_offset.stdout_lines | join('\n') }}