1249
This commit is contained in:
@@ -742,6 +742,57 @@
|
|||||||
payload_encoding: "string"
|
payload_encoding: "string"
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
|
# ----------------------- Dev1 fw_printenv size → cpe_bootenv -----------------------
|
||||||
|
- name: Dev1 | Read fw_printenv size (line count)
|
||||||
|
delegate_to: localhost
|
||||||
|
shell: |
|
||||||
|
sshpass -p '{{ dev1_pass }}' ssh {{ ssh_opts_common }} \
|
||||||
|
"{{ dev1_user }}@{{ ansible_host|default(inventory_hostname) }}" \
|
||||||
|
"fw_printenv 2>/dev/null | wc -l"
|
||||||
|
args:
|
||||||
|
executable: /bin/bash
|
||||||
|
register: dev1_bootenv_wc
|
||||||
|
changed_when: false
|
||||||
|
failed_when: false
|
||||||
|
ignore_errors: true
|
||||||
|
|
||||||
|
- name: Dev1 | Normalize cpe_bootenv value
|
||||||
|
delegate_to: localhost
|
||||||
|
set_fact:
|
||||||
|
cpe_bootenv_value: >-
|
||||||
|
{{
|
||||||
|
'unavailable'
|
||||||
|
if (
|
||||||
|
(dev1_bootenv_wc.rc | default(1)) != 0 or
|
||||||
|
(dev1_bootenv_wc.stdout | default('') | trim) in ['', '0']
|
||||||
|
)
|
||||||
|
else (dev1_bootenv_wc.stdout | default('') | trim)
|
||||||
|
}}
|
||||||
|
|
||||||
|
- name: Publish Dev1 cpe_bootenv custom field
|
||||||
|
delegate_to: localhost
|
||||||
|
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': 'cpe_bootenv',
|
||||||
|
'task_result': cpe_bootenv_value
|
||||||
|
} | to_json }}"
|
||||||
|
payload_encoding: "string"
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
|
||||||
# ----------------------- Dev2 auth + firmux -----------------------
|
# ----------------------- Dev2 auth + firmux -----------------------
|
||||||
- name: Try DEV2 login
|
- name: Try DEV2 login
|
||||||
when: tunnel_ok|default(false)
|
when: tunnel_ok|default(false)
|
||||||
|
|||||||
Reference in New Issue
Block a user