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