22:39
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
---
|
|
||||||
# sot-updater.yml — Read fw on Dev1 + Dev2, publish to NetBox via Rabbit (telemetry mode)
|
# sot-updater.yml — Read fw on Dev1 + Dev2, publish to NetBox via Rabbit (telemetry mode)
|
||||||
|
|
||||||
- name: Read fw on Dev1 + Dev2, publish NetBox custom fields (full base, AIRPINGs, soft-fail telemetry)
|
- name: Read fw on Dev1 + Dev2, publish NetBox custom fields (full base, AIRPINGs, soft-fail telemetry)
|
||||||
@@ -37,6 +36,9 @@
|
|||||||
rmq_exchange: "{{ lookup('env','RMQ_EXCHANGE') | default('controls', true) }}"
|
rmq_exchange: "{{ lookup('env','RMQ_EXCHANGE') | default('controls', true) }}"
|
||||||
control_queue: "{{ lookup('env','CONTROLQUEUE') | default('queue_controls', true) }}"
|
control_queue: "{{ lookup('env','CONTROLQUEUE') | default('queue_controls', true) }}"
|
||||||
|
|
||||||
|
# === NEW (surgical): requeue attempt counter from environment, default 0 ===
|
||||||
|
requeue_attempt: "{{ (lookup('env','REQUEUE_ATTEMPT') | default('0', true)) | int }}"
|
||||||
|
|
||||||
pre_tasks:
|
pre_tasks:
|
||||||
- name: "NB preflight | Verify script exists"
|
- name: "NB preflight | Verify script exists"
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
@@ -239,6 +241,7 @@
|
|||||||
- nb_script.stat.exists
|
- nb_script.stat.exists
|
||||||
- nb_ip_changed | default(false)
|
- nb_ip_changed | default(false)
|
||||||
- (nb_preflight.rc | default(1)) == 0 # <— extra safety
|
- (nb_preflight.rc | default(1)) == 0 # <— extra safety
|
||||||
|
- (requeue_attempt | int) < 3 # <— NEW: limit to 3 tries
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
uri:
|
uri:
|
||||||
url: "http://{{ rmq_host }}:{{ rmq_port }}/api/exchanges/app/deviceconfig.delayed/publish"
|
url: "http://{{ rmq_host }}:{{ rmq_port }}/api/exchanges/app/deviceconfig.delayed/publish"
|
||||||
@@ -254,9 +257,15 @@
|
|||||||
body:
|
body:
|
||||||
properties:
|
properties:
|
||||||
content_type: "application/json"
|
content_type: "application/json"
|
||||||
headers: { x-delay: 3000 }
|
# === NEW (surgical): 20s delay instead of 3s ===
|
||||||
|
headers: { x-delay: 20000 }
|
||||||
routing_key: "deviceconfig"
|
routing_key: "deviceconfig"
|
||||||
payload: "{{ {'inscope_device': (ansible_hostname | default(inventory_hostname)), 'task_name': 'sot-updater'} | to_json }}"
|
# === NEW (surgical): include attempt counter in payload ===
|
||||||
|
payload: "{{ {
|
||||||
|
'inscope_device': (ansible_hostname | default(inventory_hostname)),
|
||||||
|
'task_name': 'sot-updater',
|
||||||
|
'attempt': ((requeue_attempt | int) + 1)
|
||||||
|
} | to_json }}"
|
||||||
payload_encoding: "string"
|
payload_encoding: "string"
|
||||||
register: rmq_requeue
|
register: rmq_requeue
|
||||||
changed_when: false
|
changed_when: false
|
||||||
@@ -267,6 +276,7 @@
|
|||||||
- nb_script.stat.exists
|
- nb_script.stat.exists
|
||||||
- nb_ip_changed | default(false)
|
- nb_ip_changed | default(false)
|
||||||
- (nb_preflight.rc | default(1)) == 0 # <— extra safety
|
- (nb_preflight.rc | default(1)) == 0 # <— extra safety
|
||||||
|
- (requeue_attempt | int) < 3 # <— NEW: only if we actually published
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg:
|
msg:
|
||||||
|
|||||||
Reference in New Issue
Block a user