f6f190158ed76bc43fc518197da2300b0fef72bf
[icn.git] / deploy / machine / templates / _networkdata.json
1 {{- define "machine.networkData" -}}
2 {{- if .networks -}}
3 {
4   "links": [
5 {{- $local := dict "first" true -}}
6 {{- range $name, $network := .networks }}
7 {{- if not $local.first }}
8     },{
9 {{- else }}
10     {
11 {{- end }}
12 {{- $_ := set $local "first" false }}
13       "id": "{{ $name }}_nic",
14       "ethernet_mac_address": "{{ $network.macAddress }}",
15       "type": "phy"
16 {{- end }}
17     }
18   ],
19   "networks": [
20 {{- $local := dict "first" true -}}
21 {{- range $name, $network := .networks }}
22 {{- if not $local.first }}
23     },{
24 {{- else }}
25     {
26 {{- end }}
27 {{- $_ := set $local "first" false }}
28       "id": "{{ $name }}",
29       "link": "{{ $name }}_nic",
30       "type": "{{ $network.type }}"{{- if $network.ipAddress }},
31       "ip_address": "{{ $network.ipAddress }}"{{- end }}{{- if $network.gateway }},
32       "gateway": "{{ $network.gateway }}"{{- end }}{{- if $network.nameservers }},
33       "dns_nameservers": {{ $network.nameservers }}{{- end }}
34 {{- end }}
35     }
36   ],
37   "services": []
38 }
39 {{ end }}
40 {{- end }}