@ -84,7 +84,7 @@
|
|||||||
- name: Scan Subnet
|
- name: Scan Subnet
|
||||||
ansible.builtin.include_tasks:
|
ansible.builtin.include_tasks:
|
||||||
file: tasks/scan_subnet.yaml
|
file: tasks/scan_subnet.yaml
|
||||||
loop: "{{ nfc_c_scan_agent_subnets }}"
|
loop: "{{ nfc_c_scan_agent_subnets | default([]) }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: subnet
|
loop_var: subnet
|
||||||
|
|
||||||
|
@ -15,15 +15,27 @@
|
|||||||
api_query_string: "filter_by=scanAgent&filter_value={{ nfc_c_scan_agent_id }}"
|
api_query_string: "filter_by=scanAgent&filter_value={{ nfc_c_scan_agent_id }}"
|
||||||
|
|
||||||
|
|
||||||
- name: Update Subnets List
|
- name: Try/Catch
|
||||||
ansible.builtin.set_fact:
|
block:
|
||||||
nfc_c_scan_agent_subnets: "{{ nfc_c_scan_agent_subnets + [{
|
|
||||||
'id': network.id,
|
|
||||||
'address': network.subnet + '/' + network.mask
|
- name: Update Subnets List
|
||||||
}] }}"
|
ansible.builtin.set_fact:
|
||||||
loop: "{{ data | default ([]) }}"
|
nfc_c_scan_agent_subnets: "{{ nfc_c_scan_agent_subnets + [{
|
||||||
loop_control:
|
'id': network.id,
|
||||||
loop_var: network
|
'address': network.subnet + '/' + network.mask
|
||||||
vars:
|
}] }}"
|
||||||
data: "{{ lookup('file', cache_filepath) }}"
|
loop: "{{ lookup('file', cache_filepath) | default ([]) }}"
|
||||||
when: network.discoverSubnet | int == 1
|
loop_control:
|
||||||
|
loop_var: network
|
||||||
|
when: >
|
||||||
|
network.discoverSubnet | int == 1
|
||||||
|
|
||||||
|
rescue:
|
||||||
|
|
||||||
|
- name: Confirm 'Subnets List' Error is Expected
|
||||||
|
ansible.builtin.assert:
|
||||||
|
that:
|
||||||
|
- not cached_file.stat.exists
|
||||||
|
success_msg: "OK. Success. The error occured as there is no cache file. This normally means there are no subnets assigned to the agent."
|
||||||
|
fail_msg: "ERROR. Something went wrong, Cache file exists."
|
||||||
|
Reference in New Issue
Block a user