blob: 9ab7824cf5174aa971240b1442688023314191b6 [file] [log] [blame]
Dennis Dmitrievf4826bc2017-09-28 19:03:54 +03001{#- Collect interface roles and params into the following dict:
2 # interface_role: # filename that will be included
3 # interface_name: # interface (eth0)
4 # interface_param1: value # optional parameters or empty dict
5 # interface_param2: value
6 # ...
7 #}
8{%- set interface_roles = {} %}
9{%- for interface_name, interface in node['interfaces'].items() %}
10 {%- if interface['role'] not in interface_roles %}
11 {%- set _ = interface_roles.update({interface['role']: {}}) %}
12 {%- endif %}
13 {%- set _ = interface_roles[interface['role']].update({interface_name: {}}) %}
14 {%- for param_name, param in interface.items() %}
15 {%- set _ = interface_roles[interface['role']][interface_name].update({param_name: param}) %}
16 {%- endfor %}
17{%- endfor %}
18{%- set _ = params.update({'linux_network_interfaces': "\n"}) %}
19{%- for interfaces_role, interfaces in interface_roles.items() %}
20 {%- import ("{# interfaces #}/" + interfaces_role) as interface with context %}
21 {%- set _ = params.update({'linux_network_interfaces': params['linux_network_interfaces'] + interface|string }) %}
22{%- endfor %}
23 - environment.{{ cookiecutter._env_name }}.linux_network_interface