File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
ansible/roles/wait-hosts-discovered/tasks Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change 6
6
host_bmc : " {{ (discovered_host.inventory | from_json).bmc_address }}"
7
7
when : lab in cloud_labs
8
8
9
- - name : Set the host ID
9
+ - name : Set the host id and list of mac addresses
10
10
set_fact :
11
- host_interfaces : " {{ (discovered_host.inventory | from_json).interfaces }}"
12
11
host_id : " {{ discovered_host.id }}"
12
+ host_macs : " {{ (discovered_host.inventory | from_json) | json_query('interfaces[].mac_address') | lower }}"
13
13
14
14
- name : Set the hostname and role via mac address
15
15
set_fact :
16
- hostname : " {{ item.0 }}"
17
- host_role : " {{ hostvars[item.0 ]['role'] }}"
16
+ hostname : " {{ item }}"
17
+ host_role : " {{ hostvars[item]['role'] }}"
18
18
when :
19
19
- lab in rh_labs
20
- - hostvars[item.0 ]['lab_mac '] == item.1.mac_address
21
- loop : " {{ inventory_nodes | product(host_interfaces) | list }}"
20
+ - hostvars[item]['mac_address '] | lower in host_macs
21
+ loop : " {{ inventory_nodes }}"
22
22
loop_control :
23
- label : " {{ hostvars[item.0 ]['bmc_address'] }}"
23
+ label : " {{ hostvars[item]['bmc_address'] }}"
24
24
25
25
- name : Set the hostname and role via bmc address
26
26
set_fact :
You can’t perform that action at this time.
0 commit comments