1044
This commit is contained in:
@@ -376,7 +376,7 @@
|
|||||||
changed_when: (rmq_cleanup_success.json is defined) and (rmq_cleanup_success.json.routed | default(false) | bool)
|
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)
|
# Scheduled success only: chain next step (set action_next + trigger worker)
|
||||||
- name: Scheduled success | Set action_next to sot-updater-wrapper
|
- name: Scheduled success | Set action_next to sot-updater-scheduler
|
||||||
when: journal_success_payload is defined and (is_run_by_effective | default('manual')) == 'scheduler'
|
when: journal_success_payload is defined and (is_run_by_effective | default('manual')) == 'scheduler'
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
ansible.builtin.uri:
|
ansible.builtin.uri:
|
||||||
@@ -393,11 +393,11 @@
|
|||||||
properties:
|
properties:
|
||||||
content_type: "application/json"
|
content_type: "application/json"
|
||||||
routing_key: "{{ control_queue }}"
|
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: "{{ { 'inscope_device': (ansible_hostname | default(inventory_hostname)), 'task_name': 'custom_field_set', 'task_add1': 'action_next', 'task_result': 'sot-updater-scheduler' } | to_json }}"
|
||||||
payload_encoding: "string"
|
payload_encoding: "string"
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
- name: Scheduled success | Publish sot-updater-wrapper work message
|
- name: Scheduled success | Publish sot-updater-scheduler work message
|
||||||
when: journal_success_payload is defined and (is_run_by_effective | default('manual')) == 'scheduler'
|
when: journal_success_payload is defined and (is_run_by_effective | default('manual')) == 'scheduler'
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
ansible.builtin.uri:
|
ansible.builtin.uri:
|
||||||
@@ -414,7 +414,7 @@
|
|||||||
properties:
|
properties:
|
||||||
content_type: "application/json"
|
content_type: "application/json"
|
||||||
routing_key: "deviceconfig"
|
routing_key: "deviceconfig"
|
||||||
payload: "{{ { 'inscope_device': (ansible_hostname | default(inventory_hostname)), 'task_name': 'sot-updater-wrapper' } | to_json }}"
|
payload: "{{ { 'inscope_device': (ansible_hostname | default(inventory_hostname)), 'task_name': 'sot-updater-scheduler' } | to_json }}"
|
||||||
payload_encoding: "string"
|
payload_encoding: "string"
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
|
|||||||
@@ -805,7 +805,7 @@
|
|||||||
changed_when: false
|
changed_when: false
|
||||||
when: journal_success_payload is defined
|
when: journal_success_payload is defined
|
||||||
|
|
||||||
- name: Scheduled success set action_next to sot-updater-wrapper
|
- name: Scheduled success set action_next to sot-updater-scheduler
|
||||||
when: journal_success_payload is defined and (is_run_by_effective | default('manual')) == 'scheduler'
|
when: journal_success_payload is defined and (is_run_by_effective | default('manual')) == 'scheduler'
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
ansible.builtin.uri:
|
ansible.builtin.uri:
|
||||||
@@ -822,11 +822,11 @@
|
|||||||
properties:
|
properties:
|
||||||
content_type: "application/json"
|
content_type: "application/json"
|
||||||
routing_key: "{{ control_queue }}"
|
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: "{{ { 'inscope_device': (ansible_hostname | default(inventory_hostname)), 'task_name': 'custom_field_set', 'task_add1': 'action_next', 'task_result': 'sot-updater-scheduler' } | to_json }}"
|
||||||
payload_encoding: "string"
|
payload_encoding: "string"
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
- name: Scheduled success publish sot-updater-wrapper work message
|
- name: Scheduled success publish sot-updater-scheduler work message
|
||||||
when: journal_success_payload is defined and (is_run_by_effective | default('manual')) == 'scheduler'
|
when: journal_success_payload is defined and (is_run_by_effective | default('manual')) == 'scheduler'
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
ansible.builtin.uri:
|
ansible.builtin.uri:
|
||||||
@@ -843,7 +843,7 @@
|
|||||||
properties:
|
properties:
|
||||||
content_type: "application/json"
|
content_type: "application/json"
|
||||||
routing_key: "deviceconfig"
|
routing_key: "deviceconfig"
|
||||||
payload: "{{ { 'inscope_device': (ansible_hostname | default(inventory_hostname)), 'task_name': 'sot-updater-wrapper' } | to_json }}"
|
payload: "{{ { 'inscope_device': (ansible_hostname | default(inventory_hostname)), 'task_name': 'sot-updater-scheduler' } | to_json }}"
|
||||||
payload_encoding: "string"
|
payload_encoding: "string"
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
|
|||||||
47
files/ansible-playbooks/wifidebug-scheduler.yml
Normal file
47
files/ansible-playbooks/wifidebug-scheduler.yml
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
---
|
||||||
|
- name: WiFiDebug scheduler wrapper
|
||||||
|
hosts: all
|
||||||
|
gather_facts: false
|
||||||
|
|
||||||
|
vars:
|
||||||
|
sot_wrapper_mode: true
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Run sot-updater-iponly in wrapper mode
|
||||||
|
import_playbook: sot-updater-iponly.yml
|
||||||
|
|
||||||
|
- name: Extract NetBox IP from preflight output
|
||||||
|
set_fact:
|
||||||
|
nb_ip: >-
|
||||||
|
{{
|
||||||
|
(nb_preflight.stdout_lines
|
||||||
|
| select('match', '^NB_IP=')
|
||||||
|
| list
|
||||||
|
| first
|
||||||
|
| regex_replace('^NB_IP=', '')
|
||||||
|
) | default('')
|
||||||
|
}}
|
||||||
|
when:
|
||||||
|
- nb_preflight is defined
|
||||||
|
- nb_preflight.stdout_lines is defined
|
||||||
|
|
||||||
|
- name: Fail if NetBox IP not found
|
||||||
|
fail:
|
||||||
|
msg: "NB_IP not found in nb_preflight output, cannot continue wrapper"
|
||||||
|
when:
|
||||||
|
- nb_ip is not defined or nb_ip | length == 0
|
||||||
|
|
||||||
|
- name: Override ansible_host to NetBox IP
|
||||||
|
set_fact:
|
||||||
|
ansible_host: "{{ nb_ip }}"
|
||||||
|
|
||||||
|
- name: Reset SSH connection after changing ansible_host
|
||||||
|
meta: reset_connection
|
||||||
|
|
||||||
|
- name: Small pause after reset_connection
|
||||||
|
pause:
|
||||||
|
seconds: 2
|
||||||
|
|
||||||
|
- import_playbook: wifidebug17.yml
|
||||||
|
vars:
|
||||||
|
is_run_by: "scheduler"
|
||||||
Reference in New Issue
Block a user