0921
This commit is contained in:
@@ -218,7 +218,18 @@
|
|||||||
debug:
|
debug:
|
||||||
msg: "Dev1 fw_version {{ dev1_fw_clean | default('N/A') }}"
|
msg: "Dev1 fw_version {{ dev1_fw_clean | default('N/A') }}"
|
||||||
|
|
||||||
|
# ---- NEW: read NetBox current custom field for Dev1 and conditionally publish ----
|
||||||
|
- name: NetBox | Current custom fw_version
|
||||||
|
set_fact:
|
||||||
|
nb_fw_version: "{{ (hostvars[inventory_hostname].custom_fields.fw_version | default('')) }}"
|
||||||
|
|
||||||
|
- name: Dev1 | Version matches NetBox → skip update
|
||||||
|
when: (dev1_fw_clean | default('')) == (nb_fw_version | default(''))
|
||||||
|
debug:
|
||||||
|
msg: "version matches, we'll skip Netbox update"
|
||||||
|
|
||||||
- name: Publish Dev1 fw_version
|
- name: Publish Dev1 fw_version
|
||||||
|
when: (dev1_fw_clean | default('')) != (nb_fw_version | default(''))
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
uri:
|
uri:
|
||||||
url: "http://{{ rmq_host }}:{{ rmq_port }}/api/exchanges/{{ rmq_vhost | urlencode }}/{{ rmq_exchange | urlencode }}/publish"
|
url: "http://{{ rmq_host }}:{{ rmq_port }}/api/exchanges/{{ rmq_vhost | urlencode }}/{{ rmq_exchange | urlencode }}/publish"
|
||||||
@@ -313,7 +324,18 @@
|
|||||||
| trim
|
| trim
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
# ---- NEW: read NetBox current custom field for Dev2 and conditionally publish ----
|
||||||
|
- name: NetBox | Current custom indoor_fwver
|
||||||
|
set_fact:
|
||||||
|
nb_indoor_fwver: "{{ (hostvars[inventory_hostname].custom_fields.indoor_fwver | default('')) }}"
|
||||||
|
|
||||||
|
- name: Dev2 | Version matches NetBox → skip update
|
||||||
|
when: (indoor_fw_norm | default('')) == (nb_indoor_fwver | default(''))
|
||||||
|
debug:
|
||||||
|
msg: "version matches, we'll skip Netbox update"
|
||||||
|
|
||||||
- name: Publish Dev2 indoor_fwver
|
- name: Publish Dev2 indoor_fwver
|
||||||
|
when: (indoor_fw_norm | default('')) != (nb_indoor_fwver | default(''))
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
uri:
|
uri:
|
||||||
url: "http://{{ rmq_host }}:{{ rmq_port }}/api/exchanges/{{ rmq_vhost | urlencode }}/{{ rmq_exchange | urlencode }}/publish"
|
url: "http://{{ rmq_host }}:{{ rmq_port }}/api/exchanges/{{ rmq_vhost | urlencode }}/{{ rmq_exchange | urlencode }}/publish"
|
||||||
|
|||||||
Reference in New Issue
Block a user