This commit is contained in:
2025-10-28 09:41:22 +02:00
parent f5b82755fd
commit 02e567730a

View File

@@ -218,8 +218,12 @@
debug: debug:
msg: "Dev1 fw_version {{ dev1_fw_clean | default('N/A') }}" msg: "Dev1 fw_version {{ dev1_fw_clean | default('N/A') }}"
# ---- Coalesced read of NetBox custom field for Dev1 (handles different inventory shapes) # ---- Defensive deep grep (catches fw_version anywhere in hostvars JSON)
- name: NetBox | Current custom fw_version - name: Hostvars JSON (for deep grep)
set_fact:
_hostvars_json: "{{ hostvars[inventory_hostname] | to_nice_json }}"
- name: NetBox | Current custom fw_version (coalesced)
set_fact: set_fact:
nb_fw_version: >- nb_fw_version: >-
{{ {{
@@ -242,6 +246,11 @@
hostvars[inventory_hostname].fw_version hostvars[inventory_hostname].fw_version
| default('', true) | default('', true)
) )
or
(
_hostvars_json | regex_search('\"fw_version\"\\s*:\\s*\"([^\"]*)\"', '\\1')
| default('', true)
)
| string | trim | string | trim
}} }}
@@ -346,8 +355,8 @@
| trim | trim
}} }}
# ---- Coalesced read of NetBox custom field for Dev2 (handles different inventory shapes) # ---- Defensive deep grep (catches indoor_fwver anywhere in hostvars JSON)
- name: NetBox | Current custom indoor_fwver - name: NetBox | Current custom indoor_fwver (coalesced)
set_fact: set_fact:
nb_indoor_fwver: >- nb_indoor_fwver: >-
{{ {{
@@ -370,6 +379,11 @@
hostvars[inventory_hostname].indoor_fwver hostvars[inventory_hostname].indoor_fwver
| default('', true) | default('', true)
) )
or
(
_hostvars_json | regex_search('\"indoor_fwver\"\\s*:\\s*\"([^\"]*)\"', '\\1')
| default('', true)
)
| string | trim | string | trim
}} }}