14 lines
697 B
YAML
14 lines
697 B
YAML
|
# Make expensive lookups to NetBox once for later reference by any host.
|
||
|
- name: Lookup networks and prefixes
|
||
|
set_fact:
|
||
|
vlans: '{{ query("netbox.netbox.nb_lookup", "vlans", api_filter="group=new-net", raw_data=true)
|
||
|
| sort(attribute="vid") }}'
|
||
|
prefixes: '{{ query("netbox.netbox.nb_lookup", "prefixes", raw_data=true)
|
||
|
| sort(attribute="prefix") | sort(attribute="family.value") }}'
|
||
|
|
||
|
- name: Get my cluster and all nodes in it
|
||
|
set_fact:
|
||
|
cluster: '{{ query("netbox.netbox.nb_lookup", "clusters", raw_data=true, api_filter="name="+cluster) | first }}'
|
||
|
nodes: '{{ groups["cluster_"+cluster] | map("extract", hostvars) | rejectattr("is_virtual") }}'
|
||
|
when: cluster
|