Update playbooks/ntpdig-check.yml

This commit is contained in:
2025-07-11 00:58:08 +00:00
parent 8836fa3055
commit 2f201de234

View File

@@ -24,10 +24,10 @@
changed_when: false
failed_when: ntpdig_output.rc != 0
- name: Parse offset from ntpdig output
- name: Parse correct offset and error from ntpdig output
set_fact:
ntpdig_offset: "{{ ntpdig_output.stdout | regex_search('([+-]?\\d+\\.\\d+)', '\\1') | default('N/A') }}"
ntpdig_error: "{{ ntpdig_output.stdout | regex_search('\\+/-\\s+(\\d+\\.\\d+)', '\\1') | default('N/A') }}"
ntpdig_offset: "{{ ntpdig_output.stdout | regex_search('[+-][0-9]+\\.[0-9]+(?=\\s+\\+/-)', '\\0') | default('N/A') }}"
ntpdig_error: "{{ ntpdig_output.stdout | regex_search('\\+/-\\s+([0-9]+\\.[0-9]+)', '\\1') | default('N/A') }}"
- name: Show parsed ntpdig result
debug: