- name: Quick check of time offset using ntpdate hosts: all become: true gather_facts: false vars: ntp_check_target: "pool.ntp.org" tasks: - name: Ensure ntpdate is installed apt: name: ntpdate state: present update_cache: true - name: Query time offset from {{ ntp_check_target }} command: "ntpdate -q {{ ntp_check_target }}" register: ntp_offset changed_when: false failed_when: ntp_offset.rc != 0 - 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 }}] Offset summary: {{ ntp_offset_summary }} Raw output: {{ ntp_offset.stdout_lines | join('\n') }}