Commit 43651b8f authored by nanahira's avatar nanahira

use dict

parent 87095b4c
......@@ -96,17 +96,17 @@
- mci{{inventory_hostname_short}}
# 为了提高测试时候的性能,不改动wg的时候注释掉这段
- name: 'clean up null connections first'
include_tasks: 'protocols/{{item.protocol}}/configure.yaml'
include_tasks: 'protocols/{{item.value.protocol}}/configure.yaml'
vars:
conn: '{{item}}'
with_items: '{{ connections }}'
when: "not noUpdateLinks and item.protocol is defined and item.protocol == 'null' and not item.noUpdate"
conn: '{{item.value}}'
with_dict: '{{ connections }}'
when: "not noUpdateLinks and item.value.protocol == 'null' and not item.value.noUpdate"
- name: 'loop through list from a variable'
include_tasks: 'protocols/{{item.protocol}}/configure.yaml'
include_tasks: 'protocols/{{item.value.protocol}}/configure.yaml'
vars:
conn: '{{item}}'
with_items: '{{ connections }}'
when: "not noUpdateLinks and item.protocol is defined and item.protocol != 'null' and not item.noUpdate"
conn: '{{item.value}}'
with_dict: '{{ connectionsDict }}'
when: "not noUpdateLinks and item.value.protocol != 'null' and not item.value.noUpdate"
# end
- name: services conf
copy:
......
......@@ -424,6 +424,7 @@ class InventoryBuilder {
ocpasswdLines: host.ocpasswdLines || [],
gateways: _.values(this.gateways[host.name]),
connections,
connectionsDict: _.keyBy(connections, 'name'),
lanInterfaces,
localSubnets,
masqInterfaces,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment