1029
This commit is contained in:
@@ -32,7 +32,7 @@
|
||||
|
||||
tasks:
|
||||
# ───────────────────────── Progress: start ─────────────────────────
|
||||
- name: ⚙️ Start | Device processing begins (Dev1 phase)
|
||||
- name: "⚙️ Start | Device processing begins (Dev1 phase)"
|
||||
debug:
|
||||
msg:
|
||||
- "Device: {{ inventory_hostname }}"
|
||||
@@ -49,19 +49,11 @@
|
||||
msg:
|
||||
- "Dev1 banner raw: {{ (dev1_banner.stdout | default('') | trim) | regex_replace('\\n',' ') }}"
|
||||
|
||||
# ***** FIXED: Strictly extract ONLY "X.Y.Z rev NNNN" from the banner *****
|
||||
# This grabs the first occurrence of "<digits>.<digits>.<digits> rev <digits>"
|
||||
# and ignores any trailing timestamp like " | 2025-09-25 07:06:10".
|
||||
# Extract exactly "X.Y.Z rev NNNN" by dropping anything after the pipe
|
||||
- name: Dev1 | Extract 'X.Y.Z rev NNNN' by removing trailing timestamp
|
||||
delegate_to: localhost
|
||||
set_fact:
|
||||
dev1_fw_clean: >-
|
||||
{{
|
||||
(dev1_banner.stdout | default('') | trim)
|
||||
| regex_replace('\\s*\\|.*$', '') # drop " | 2025-09-25 ..." and anything after
|
||||
}}
|
||||
|
||||
|
||||
dev1_fw_clean: "{{ (dev1_banner.stdout | default('') | trim) | regex_replace('\\s*\\|.*$', '') }}"
|
||||
|
||||
- name: Dev1 | Debug normalized fw string to be published
|
||||
delegate_to: localhost
|
||||
@@ -69,15 +61,11 @@
|
||||
msg:
|
||||
- "Dev1 fw_version (clean): {{ dev1_fw_clean }}"
|
||||
|
||||
- name: Dev2 | Build payload preview string
|
||||
when:
|
||||
- dev2_passfile_used is defined
|
||||
- dev2_passfile_used != "NONE"
|
||||
- indoor_fw_norm is defined
|
||||
- (indoor_fw_norm | length) > 0
|
||||
# Build payload preview for Dev1 (so the next debug is defined)
|
||||
- name: Dev1 | Build payload preview string
|
||||
delegate_to: localhost
|
||||
set_fact:
|
||||
dev2_payload_preview: >-
|
||||
dev1_payload_preview: >-
|
||||
{{
|
||||
{
|
||||
"properties": {"content_type": "application/json"},
|
||||
@@ -85,15 +73,15 @@
|
||||
"payload": ({
|
||||
"inscope_device": (ansible_hostname | default(inventory_hostname)),
|
||||
"task_name": "custom_field_set",
|
||||
"task_add1": "indoor_fwver",
|
||||
"task_result": indoor_fw_norm # ← FIXED
|
||||
"task_add1": "fw_version",
|
||||
"task_result": dev1_fw_clean
|
||||
} | to_json),
|
||||
"payload_encoding": "string"
|
||||
} | to_json
|
||||
}}
|
||||
|
||||
|
||||
- name: Dev1 | Debug EXACT publish body (payload preview)
|
||||
when: dev1_payload_preview is defined
|
||||
delegate_to: localhost
|
||||
debug:
|
||||
var: dev1_payload_preview
|
||||
@@ -128,7 +116,7 @@
|
||||
msg:
|
||||
- "Dev1 publish response: {{ dev1_publish_resp.json | default(dev1_publish_resp) }}"
|
||||
|
||||
- name: ✅ Progress | Completed Dev1, moving to tunnel & Dev2 phase
|
||||
- name: "✅ Progress | Completed Dev1, moving to tunnel & Dev2 phase"
|
||||
debug:
|
||||
msg:
|
||||
- "Device: {{ inventory_hostname }}"
|
||||
@@ -251,7 +239,7 @@
|
||||
ansible.builtin.meta: end_host
|
||||
when: nc_probe.rc != 0
|
||||
|
||||
- name: ✅ Progress | Tunnel OK, proceeding to Dev2 auth and reads
|
||||
- name: "✅ Progress | Tunnel OK, proceeding to Dev2 auth and reads"
|
||||
debug:
|
||||
msg:
|
||||
- "Device: {{ inventory_hostname }}"
|
||||
@@ -396,9 +384,10 @@
|
||||
msg:
|
||||
- "Dev2 indoor_fw_norm: {{ indoor_fw_norm }}"
|
||||
|
||||
# Build payload preview (exact string).
|
||||
# Build payload preview (exact string) — single, corrected task
|
||||
- name: Dev2 | Build payload preview string
|
||||
when:
|
||||
- dev2_passfile_used is defined
|
||||
- dev2_passfile_used != "NONE"
|
||||
- indoor_fw_norm is defined
|
||||
- (indoor_fw_norm | length) > 0
|
||||
@@ -413,7 +402,7 @@
|
||||
"inscope_device": (ansible_hostname | default(inventory_hostname)),
|
||||
"task_name": "custom_field_set",
|
||||
"task_add1": "indoor_fwver",
|
||||
"task_result': indoor_fw_norm
|
||||
"task_result": indoor_fw_norm
|
||||
} | to_json),
|
||||
"payload_encoding": "string"
|
||||
} | to_json
|
||||
@@ -463,7 +452,7 @@
|
||||
- "Dev2 publish response: {{ dev2_publish_resp.json | default(dev2_publish_resp) }}"
|
||||
|
||||
post_tasks:
|
||||
- name: ✅ Progress | Finishing up (cleanup)
|
||||
- name: "✅ Progress | Finishing up (cleanup)"
|
||||
debug:
|
||||
msg:
|
||||
- "Cleanup phase: closing ControlMaster & removing temp IP"
|
||||
@@ -498,7 +487,7 @@
|
||||
- "stdout={{ (del_ip.stdout | default('')) | trim }}"
|
||||
- "stderr={{ (del_ip.stderr | default('')) | trim }}"
|
||||
|
||||
- name: ✅ Progress | Completed device processing
|
||||
- name: "✅ Progress | Completed device processing"
|
||||
debug:
|
||||
msg:
|
||||
- "Device: {{ inventory_hostname }}"
|
||||
|
||||
Reference in New Issue
Block a user