1021
This commit is contained in:
@@ -52,17 +52,17 @@
|
|||||||
# ***** FIXED: Strictly extract ONLY "X.Y.Z rev NNNN" from the banner *****
|
# ***** FIXED: Strictly extract ONLY "X.Y.Z rev NNNN" from the banner *****
|
||||||
# This grabs the first occurrence of "<digits>.<digits>.<digits> rev <digits>"
|
# This grabs the first occurrence of "<digits>.<digits>.<digits> rev <digits>"
|
||||||
# and ignores any trailing timestamp like " | 2025-09-25 07:06:10".
|
# and ignores any trailing timestamp like " | 2025-09-25 07:06:10".
|
||||||
- name: Dev1 | Extract exact 'X.Y.Z rev NNNN' (no timestamp)
|
- name: Dev1 | Extract 'X.Y.Z rev NNNN' by removing trailing timestamp
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
set_fact:
|
set_fact:
|
||||||
dev1_fw_clean: >-
|
dev1_fw_clean: >-
|
||||||
{{
|
{{
|
||||||
(dev1_banner.stdout | default('') | trim)
|
(dev1_banner.stdout | default('') | trim)
|
||||||
| regex_search('(?i)[0-9]+\\.[0-9]+\\.[0-9]+\\s+rev\\s+[0-9]+')
|
| regex_replace('\\s*\\|.*$', '') # drop " | 2025-09-25 ..." and anything after
|
||||||
| default('')
|
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- name: Dev1 | Debug normalized fw string to be published
|
- name: Dev1 | Debug normalized fw string to be published
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
debug:
|
debug:
|
||||||
@@ -86,7 +86,7 @@
|
|||||||
"inscope_device": (ansible_hostname | default(inventory_hostname)),
|
"inscope_device": (ansible_hostname | default(inventory_hostname)),
|
||||||
"task_name": "custom_field_set",
|
"task_name": "custom_field_set",
|
||||||
"task_add1": "indoor_fwver",
|
"task_add1": "indoor_fwver",
|
||||||
"task_result": indoor_fw_norm
|
"task_result": indoor_fw_norm # ← FIXED
|
||||||
} | to_json),
|
} | to_json),
|
||||||
"payload_encoding": "string"
|
"payload_encoding": "string"
|
||||||
} | to_json
|
} | to_json
|
||||||
|
|||||||
Reference in New Issue
Block a user