Change NIC template format
[apex.git] / build / nics-controller.yaml.jinja2
1 heat_template_version: 2015-04-30
2
3 description: >
4   Software Config to drive os-net-config to configure multiple interfaces
5   for the controller role.
6
7 parameters:
8   ControlPlaneIp:
9     default: ''
10     description: IP address/subnet on the ctlplane network
11     type: string
12   ExternalIpSubnet:
13     default: ''
14     description: IP address/subnet on the external network
15     type: string
16   InternalApiIpSubnet:
17     default: ''
18     description: IP address/subnet on the internal API network
19     type: string
20   StorageIpSubnet:
21     default: ''
22     description: IP address/subnet on the storage network
23     type: string
24   StorageMgmtIpSubnet:
25     default: ''
26     description: IP address/subnet on the storage mgmt network
27     type: string
28   TenantIpSubnet:
29     default: ''
30     description: IP address/subnet on the tenant network
31     type: string
32   ManagementIpSubnet: # Only populated when including environments/network-management.yaml
33     default: ''
34     description: IP address/subnet on the management network
35     type: string
36   ExternalNetworkVlanID:
37     default: 10
38     description: Vlan ID for the external network traffic.
39     type: number
40   InternalApiNetworkVlanID:
41     default: 20
42     description: Vlan ID for the internal_api network traffic.
43     type: number
44   StorageNetworkVlanID:
45     default: 30
46     description: Vlan ID for the storage network traffic.
47     type: number
48   StorageMgmtNetworkVlanID:
49     default: 40
50     description: Vlan ID for the storage mgmt network traffic.
51     type: number
52   TenantNetworkVlanID:
53     default: 50
54     description: Vlan ID for the tenant network traffic.
55     type: number
56   ExternalInterfaceDefaultRoute:
57     default: '10.0.0.1'
58     description: default route for the external network
59     type: string
60   ControlPlaneSubnetCidr: # Override this via parameter_defaults
61     default: '24'
62     description: The subnet CIDR of the control plane network.
63     type: string
64   ControlPlaneDefaultRoute: # Override this via parameter_defaults
65     description: The subnet CIDR of the control plane network.
66     type: string
67   DnsServers: # Override this via parameter_defaults
68     default: []
69     description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
70     type: comma_delimited_list
71   EC2MetadataIp: # Override this via parameter_defaults
72     description: The IP address of the EC2 metadata server.
73     type: string
74
75 resources:
76   OsNetConfigImpl:
77     type: OS::Heat::StructuredConfig
78     properties:
79       group: os-apply-config
80       config:
81         os_net_config:
82           network_config:
83             -
84               type: interface
85               name: nic1
86               use_dhcp: false
87               dns_servers: {get_param: DnsServers}
88               addresses:
89                 -
90                   ip_netmask:
91                     list_join:
92                       - '/'
93                       - - {get_param: ControlPlaneIp}
94                         - {get_param: ControlPlaneSubnetCidr}
95               routes:
96                 -
97                   ip_netmask: 169.254.169.254/32
98                   next_hop: {get_param: EC2MetadataIp}
99                 {%- if external_net_af == 6 %}
100                 -
101                   default: true
102                   next_hop: {get_param: ControlPlaneDefaultRoute}
103                 {%- endif %}
104             {%- set nic_index = 2 %}
105             {%- if 'private_network' in enabled_networks %}
106             -
107               # Create a bridge which can also be used for VLAN-mode bridge mapping
108               type: ovs_bridge
109               name: br-tenant
110               use_dhcp: false
111               addresses:
112                 -
113                   ip_netmask: {get_param: TenantIpSubnet}
114               members:
115                 -
116                   type: interface
117                   name: nic{{ nic_index }}{% set nic_index = nic_index + 1 %}
118                   use_dhcp: false
119                   # force the MAC address of the bridge to this interface
120                   primary: true
121             {%- endif %}
122             -
123               type: ovs_bridge
124               name: {get_input: bridge_name}
125               dns_servers: {get_param: DnsServers}
126               use_dhcp: false
127               addresses:
128                 -
129                   ip_netmask: {get_param: ExternalIpSubnet}
130               routes:
131                 -
132                   default: true
133                   next_hop: {get_param: ExternalInterfaceDefaultRoute}
134               members:
135                 -
136                   type: interface
137                   name: nic{{ nic_index }}{% set nic_index = nic_index + 1 %}
138                   # force the MAC address of the bridge to this interface
139                   primary: true
140             {%- if 'storage_network' in enabled_networks %}
141             -
142               type: interface
143               name: nic{{ nic_index }}{% set nic_index = nic_index + 1 %}
144               use_dhcp: false
145               addresses:
146                 -
147                   ip_netmask: {get_param: StorageIpSubnet}
148             {%- endif %}
149             {%- if 'api_network' in enabled_networks %}
150             -
151               type: interface
152               name: nic{{ nic_index }}{% set nic_index = nic_index + 1 %}
153               use_dhcp: false
154               addresses:
155                 -
156                   ip_netmask: {get_param: InternalApiIpSubnet}
157             {%- endif %}
158
159 outputs:
160   OS::stack_id:
161     description: The OsNetConfigImpl resource.
162     value: {get_resource: OsNetConfigImpl}