diff --git a/files/ansible-playbooks/afterupgrade_check.yml b/files/ansible-playbooks/afterupgrade_check.yml index a85de61..4ba7ba4 100644 --- a/files/ansible-playbooks/afterupgrade_check.yml +++ b/files/ansible-playbooks/afterupgrade_check.yml @@ -375,6 +375,49 @@ register: rmq_cleanup_success changed_when: (rmq_cleanup_success.json is defined) and (rmq_cleanup_success.json.routed | default(false) | bool) + # Scheduled success only: chain next step (set action_next + trigger worker) + - name: Scheduled success | Set action_next to sot-updater-wrapper + when: journal_success_payload is defined and (is_run_by_effective | default('manual')) == 'scheduled' + 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: "{{ { 'inscope_device': (ansible_hostname | default(inventory_hostname)), 'task_name': 'custom_field_set', 'task_add1': 'action_next', 'task_result': 'sot-updater-wrapper' } | to_json }}" + payload_encoding: "string" + changed_when: false + + - name: Scheduled success | Publish sot-updater-wrapper work message + when: journal_success_payload is defined and (is_run_by_effective | default('manual')) == 'scheduled' + delegate_to: localhost + ansible.builtin.uri: + url: "http://{{ rmq_host }}:{{ rmq_port }}/api/exchanges/{{ rmq_vhost | urlencode }}/{{ 'deviceconfig' | 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: "deviceconfig" + payload: "{{ { 'inscope_device': (ansible_hostname | default(inventory_hostname)), 'task_name': 'sot-updater-wrapper' } | to_json }}" + payload_encoding: "string" + changed_when: false + # Mismatch: reachable & banner read, but not equal to target_version - name: Build mismatch journal payload