1723
This commit is contained in:
@@ -316,68 +316,6 @@
|
||||
ansible.builtin.meta: end_host
|
||||
when: (prep_scan.stdout | trim) == 'PRESENT'
|
||||
|
||||
# --- SSID scan & journal (does not stop the play) ---
|
||||
- name: Count SSID lines in /tmp/config.json (filtered)
|
||||
ansible.builtin.raw: >
|
||||
{{ pathprefix }}
|
||||
grep '"ssid"' /tmp/config.json 2>/dev/null | grep -vE '\{|SC|auto|backha' | wc -l
|
||||
register: ssid_lines
|
||||
changed_when: false
|
||||
|
||||
- name: Debug SSID count
|
||||
|
||||
ansible.builtin.debug:
|
||||
msg: "ssid_count={{ (ssid_lines.stdout | default('0')) | trim }}"
|
||||
|
||||
- name: Build joined SSID list when multiple SSIDs found (≥3)
|
||||
ansible.builtin.raw: >
|
||||
{{ pathprefix }}
|
||||
grep '"ssid"' /tmp/config.json | grep -vE '\{|SC|auto|backha' \
|
||||
| sed -E 's/.*"ssid": "([^"]+)".*/\1/' \
|
||||
| awk 'NR==1 { out=$0; next } { out=out","$0 } END { print out }'
|
||||
register: ssid_concat
|
||||
changed_when: false
|
||||
when: (ssid_lines.stdout | trim | int) >= 3
|
||||
|
||||
- name: Build control queue payload for SSID journal (journal_add)
|
||||
ansible.builtin.set_fact:
|
||||
ssid_journal_payload:
|
||||
inscope_device: "{{ ansible_hostname | default(inventory_hostname) }}"
|
||||
task_name: "journal_add"
|
||||
task_result: "Multiple SSID! {{ ssid_concat.stdout | trim }}"
|
||||
when: (ssid_lines.stdout | trim | int) >= 3
|
||||
|
||||
- name: Bandaid | Pause before Publish SSID journal to control queue via RabbitMQ HTTP API
|
||||
ansible.builtin.pause:
|
||||
seconds: 1
|
||||
delegate_to: localhost
|
||||
changed_when: false
|
||||
- name: Publish SSID journal to control queue via RabbitMQ HTTP API
|
||||
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: "{{ ssid_journal_payload | to_json }}"
|
||||
payload_encoding: "string"
|
||||
register: rmq_ssid_journal_resp
|
||||
changed_when: (rmq_ssid_journal_resp.json is defined) and (rmq_ssid_journal_resp.json.routed | default(false) | bool)
|
||||
failed_when: >
|
||||
(rmq_ssid_journal_resp.status != 200) or
|
||||
(rmq_ssid_journal_resp.json is not defined) or
|
||||
(not (rmq_ssid_journal_resp.json.routed | default(false) | bool))
|
||||
delegate_to: localhost
|
||||
when: ssid_journal_payload is defined
|
||||
|
||||
# ----------------------------- MAIN UPDATE BLOCK -----------------------------
|
||||
- name: Firmware update main block
|
||||
block:
|
||||
|
||||
Reference in New Issue
Block a user