1921
This commit is contained in:
@@ -231,44 +231,6 @@
|
||||
register: rmq_j_success
|
||||
changed_when: (rmq_j_success.json is defined) and (rmq_j_success.json.routed | default(false) | bool)
|
||||
|
||||
# NEW: send a control tag to clean up device state on success
|
||||
- name: Build cleanup control payload (update_cleanup_success)
|
||||
when: journal_success_payload is defined
|
||||
delegate_to: localhost
|
||||
ansible.builtin.set_fact:
|
||||
control_cleanup_payload:
|
||||
inscope_device: "{{ ansible_hostname | default(inventory_hostname) }}"
|
||||
task_name: "update_cleanup_success"
|
||||
|
||||
- name: Publish cleanup control message to control queue
|
||||
when: control_cleanup_payload is defined
|
||||
delegate_to: localhost
|
||||
ansible.builtin.uri:
|
||||
url: "http://{{ rmq_host }}:{{ rmq_port }}/api/exchanges/{{ rmq_vhost | urlencode }}/{{ rmq_exchange | urlencode }}/publish"
|
||||
method: POST
|
||||
user: "{{ rmq_user }}"
|
||||
password: "{{ rmq_pass }}"
|
||||
force_basic_auth: true
|
||||
status_code: 200
|
||||
headers:
|
||||
content-type: "application/json"
|
||||
body_format: json
|
||||
body:
|
||||
properties:
|
||||
content_type: "application/json"
|
||||
routing_key: "{{ control_queue }}"
|
||||
payload: "{{ control_cleanup_payload | to_json }}"
|
||||
payload_encoding: "string"
|
||||
register: rmq_cleanup_success
|
||||
changed_when: (rmq_cleanup_success.json is defined) and (rmq_cleanup_success.json.routed | default(false) | bool)
|
||||
|
||||
- name: Success | Pause before NetBox wrapup custom fields
|
||||
ansible.builtin.pause:
|
||||
seconds: 1
|
||||
delegate_to: localhost
|
||||
changed_when: false
|
||||
when: journal_success_payload is defined
|
||||
|
||||
- name: Success | Publish action_state done
|
||||
when: journal_success_payload is defined
|
||||
delegate_to: localhost
|
||||
@@ -374,6 +336,46 @@
|
||||
payload_encoding: "string"
|
||||
changed_when: false
|
||||
|
||||
- name: Success | Pause before NetBox wrapup custom fields
|
||||
ansible.builtin.pause:
|
||||
seconds: 3
|
||||
delegate_to: localhost
|
||||
changed_when: false
|
||||
when: journal_success_payload is defined
|
||||
|
||||
# NEW: send a control tag to clean up device state on success
|
||||
- name: Build cleanup control payload (update_cleanup_success)
|
||||
when: journal_success_payload is defined
|
||||
delegate_to: localhost
|
||||
ansible.builtin.set_fact:
|
||||
control_cleanup_payload:
|
||||
inscope_device: "{{ ansible_hostname | default(inventory_hostname) }}"
|
||||
task_name: "update_cleanup_success"
|
||||
|
||||
|
||||
- name: Publish cleanup control message to control queue
|
||||
when: control_cleanup_payload is defined
|
||||
delegate_to: localhost
|
||||
ansible.builtin.uri:
|
||||
url: "http://{{ rmq_host }}:{{ rmq_port }}/api/exchanges/{{ rmq_vhost | urlencode }}/{{ rmq_exchange | urlencode }}/publish"
|
||||
method: POST
|
||||
user: "{{ rmq_user }}"
|
||||
password: "{{ rmq_pass }}"
|
||||
force_basic_auth: true
|
||||
status_code: 200
|
||||
headers:
|
||||
content-type: "application/json"
|
||||
body_format: json
|
||||
body:
|
||||
properties:
|
||||
content_type: "application/json"
|
||||
routing_key: "{{ control_queue }}"
|
||||
payload: "{{ control_cleanup_payload | to_json }}"
|
||||
payload_encoding: "string"
|
||||
register: rmq_cleanup_success
|
||||
changed_when: (rmq_cleanup_success.json is defined) and (rmq_cleanup_success.json.routed | default(false) | bool)
|
||||
|
||||
|
||||
# Mismatch: reachable & banner read, but not equal to target_version
|
||||
- name: Build mismatch journal payload
|
||||
when: nc_probe.rc == 0 and banner_probe.rc == 0 and not (version_match | bool)
|
||||
|
||||
Reference in New Issue
Block a user