1059
This commit is contained in:
@@ -349,39 +349,38 @@
|
|||||||
changed_when: false
|
changed_when: false
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- name: Dev2 | Choose raw string (firmux preferred, else banner)
|
# Dev2: firmux-only selection (prefer line with "rev NNNN")
|
||||||
|
- name: Dev2 | Select line from firmux (prefer '... rev NNNN')
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
ansible.builtin.set_fact:
|
set_fact:
|
||||||
|
_firmux_lines: "{{ (dev2_firmux.stdout | default('') | splitlines()) | map('trim') | list }}"
|
||||||
indoor_fw_raw: >-
|
indoor_fw_raw: >-
|
||||||
{{
|
{{
|
||||||
(dev2_firmux.stdout | default('') | trim)
|
(
|
||||||
if ((dev2_firmux.stdout | default('') | trim) | length > 0)
|
_firmux_lines
|
||||||
else (dev2_banner.stdout | default('') | trim)
|
| select('match', '(?i).*\\brev\\s*\\d+.*')
|
||||||
|
| list
|
||||||
|
)[0]
|
||||||
|
if (
|
||||||
|
_firmux_lines
|
||||||
|
| select('match', '(?i).*\\brev\\s*\\d+.*')
|
||||||
|
| list
|
||||||
|
| length
|
||||||
|
) > 0
|
||||||
|
else
|
||||||
|
((_firmux_lines | select('truthy') | list )[0] | default(''))
|
||||||
}}
|
}}
|
||||||
|
|
||||||
- name: Dev2 | Debug raw indoor fw string
|
- name: Dev2 | Debug chosen line from firmux
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
debug:
|
debug:
|
||||||
msg:
|
msg: "Chosen indoor_fw_raw='{{ indoor_fw_raw }}'"
|
||||||
- "Dev2 indoor_fw_raw: {{ indoor_fw_raw }}"
|
|
||||||
|
|
||||||
- name: Dev2 | Normalize to 'X.Y.Z rev NNNN' or already '-rNNNN' style
|
# Final value for NetBox: keep exactly what firmux says (no '-r' conversion)
|
||||||
|
- name: Dev2 | Final indoor fw string (no transformation)
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
ansible.builtin.set_fact:
|
set_fact:
|
||||||
indoor_fw_norm: >-
|
indoor_fw_norm: "{{ indoor_fw_raw | trim }}"
|
||||||
{{
|
|
||||||
((indoor_fw_raw | default('') | trim | lower) is search('-r[0-9]+$'))
|
|
||||||
| ternary(
|
|
||||||
(indoor_fw_raw | default('') | trim),
|
|
||||||
((indoor_fw_raw | default('') | trim) | regex_replace('\\s*[Rr][Ee][Vv]\\.??\\s*([0-9]+)\\s*$', '-r\\1'))
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
|
|
||||||
- name: Dev2 | Debug normalized indoor fw string
|
|
||||||
delegate_to: localhost
|
|
||||||
debug:
|
|
||||||
msg:
|
|
||||||
- "Dev2 indoor_fw_norm: {{ indoor_fw_norm }}"
|
|
||||||
|
|
||||||
# Build payload preview (exact string) — single, corrected task
|
# Build payload preview (exact string) — single, corrected task
|
||||||
- name: Dev2 | Build payload preview string
|
- name: Dev2 | Build payload preview string
|
||||||
|
|||||||
Reference in New Issue
Block a user