Heat templates for deploying OpenStack
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

role.role.j2.yaml 6.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. {#- Convert net map or net list to internal list of networks #}
  2. {#- NOTE(hjensas): For backward compatibility support role data with both #}
  3. {#- networks map (new schema) and network list (old schema). #}
  4. {%- set _role_networks = [] %}
  5. {%- if role.networks is mapping %}
  6. {%- for key,val in role.networks.items() %}
  7. {%- set _role_networks = _role_networks.append(key) %}
  8. {%- endfor %}
  9. {%- else %}
  10. {%- set _role_networks = role.networks %}
  11. {%- endif %}
  12. heat_template_version: rocky
  13. description: >
  14. Software Config to drive os-net-config to configure VLANs for the {{role.name}} role.
  15. parameters:
  16. ControlPlaneIp:
  17. default: ''
  18. description: IP address/subnet on the ctlplane network
  19. type: string
  20. ControlPlaneSubnetCidr:
  21. default: ''
  22. description: >
  23. The subnet CIDR of the control plane network. (The parameter is
  24. automatically resolved from the ctlplane subnet's cidr attribute.)
  25. type: string
  26. ControlPlaneDefaultRoute:
  27. default: ''
  28. description: The default route of the control plane network. (The parameter
  29. is automatically resolved from the ctlplane subnet's gateway_ip attribute.)
  30. type: string
  31. ControlPlaneStaticRoutes:
  32. default: []
  33. description: >
  34. Routes for the ctlplane network traffic.
  35. JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
  36. Unless the default is changed, the parameter is automatically resolved
  37. from the subnet host_routes attribute.
  38. type: json
  39. ControlPlaneMtu:
  40. default: 1500
  41. description: The maximum transmission unit (MTU) size(in bytes) that is
  42. guaranteed to pass through the data path of the segments in the network.
  43. (The parameter is automatically resolved from the ctlplane network's mtu attribute.)
  44. type: number
  45. {% for network in networks if network.enabled|default(true) and network.name in role.networks %}
  46. {{network.name}}IpSubnet:
  47. default: ''
  48. description: IP address/subnet on the {{network.name_lower}} network
  49. type: string
  50. {{network.name}}NetworkVlanID:
  51. default: {{network.vlan}}
  52. description: Vlan ID for the {{network.name_lower}} network traffic.
  53. type: number
  54. {{network.name}}Mtu:
  55. default: {{network.mtu}}
  56. description: The maximum transmission unit (MTU) size(in bytes) that is
  57. guaranteed to pass through the data path of the segments in the
  58. {{network.name}} network.
  59. type: number
  60. {%- if network.ipv6|default(false) and network.gateway_ipv6|default(false) %}
  61. {{network.name}}InterfaceDefaultRoute:
  62. default: '{{network.gateway_ipv6}}'
  63. description: default route for the {{network.name_lower}} network
  64. type: string
  65. {%- elif network.gateway_ip|default(false) %}
  66. {{network.name}}InterfaceDefaultRoute:
  67. default: '{{network.gateway_ip}}'
  68. description: default route for the {{network.name_lower}} network
  69. type: string
  70. {%- endif %}
  71. {{network.name}}InterfaceRoutes:
  72. default: []
  73. description: >
  74. Routes for the {{network.name_lower}} network traffic.
  75. JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
  76. Unless the default is changed, the parameter is automatically resolved
  77. from the subnet host_routes attribute.
  78. type: json
  79. {%- endfor %}
  80. DnsServers: # Override this via parameter_defaults
  81. default: []
  82. description: >
  83. DNS servers to use for the Overcloud (2 max for some implementations).
  84. If not set the nameservers configured in the ctlplane subnet's
  85. dns_nameservers attribute will be used.
  86. type: comma_delimited_list
  87. EC2MetadataIp:
  88. default: ''
  89. description: The IP address of the EC2 metadata server. (The parameter
  90. is automatically resolved from the ctlplane subnet's host_routes attribute.)
  91. type: string
  92. resources:
  93. MinViableMtu:
  94. # This resource resolves the minimum viable MTU for interfaces, bonds and
  95. # bridges that carry multiple VLANs. Each VLAN may have different MTU. The
  96. # bridge, bond or interface must have an MTU to allow the VLAN with the
  97. # largest MTU.
  98. type: OS::Heat::Value
  99. properties:
  100. type: number
  101. value:
  102. yaql:
  103. expression: $.data.max()
  104. data:
  105. - {get_param: ControlPlaneMtu}
  106. {%- for network in networks if network.enabled|default(true) and network.name in role.networks %}
  107. - {get_param: {{network.name}}Mtu}
  108. {%- endfor %}
  109. OsNetConfigImpl:
  110. type: OS::Heat::SoftwareConfig
  111. properties:
  112. group: script
  113. config:
  114. str_replace:
  115. template:
  116. get_file: ../../scripts/run-os-net-config.sh
  117. params:
  118. $network_config:
  119. network_config:
  120. - type: ovs_bridge
  121. {%- if role.name.startswith('CephStorage') or role.name.startswith('ObjectStorage') or role.name.startswith('BlockStorage') %}
  122. name: br-storage
  123. {%- else %}
  124. name: bridge_name
  125. {%- endif %}
  126. mtu:
  127. get_attr: [MinViableMtu, value]
  128. use_dhcp: false
  129. dns_servers:
  130. get_param: DnsServers
  131. addresses:
  132. - ip_netmask:
  133. list_join:
  134. - /
  135. - - get_param: ControlPlaneIp
  136. - get_param: ControlPlaneSubnetCidr
  137. routes:
  138. list_concat_unique:
  139. - get_param: ControlPlaneStaticRoutes
  140. - - ip_netmask: 169.254.169.254/32
  141. next_hop:
  142. get_param: EC2MetadataIp
  143. {%- if role.default_route_networks is not defined or 'ControlPlane' in role.default_route_networks %}
  144. - default: true
  145. next_hop:
  146. get_param: ControlPlaneDefaultRoute
  147. {%- endif %}
  148. members:
  149. - type: interface
  150. name: nic1
  151. mtu:
  152. get_attr: [MinViableMtu, value]
  153. # force the MAC address of the bridge to this interface
  154. primary: true
  155. {%- for network in networks if network.enabled|default(true) and network.name in _role_networks %}
  156. - type: vlan
  157. mtu:
  158. get_param: {{network.name}}Mtu
  159. vlan_id:
  160. get_param: {{network.name}}NetworkVlanID
  161. addresses:
  162. - ip_netmask:
  163. get_param: {{network.name}}IpSubnet
  164. routes:
  165. list_concat_unique:
  166. - get_param: {{network.name}}InterfaceRoutes
  167. {%- if network.name in role.default_route_networks %}
  168. - - default: true
  169. next_hop:
  170. get_param: {{network.name}}InterfaceDefaultRoute
  171. {%- endif %}
  172. {%- endfor %}
  173. outputs:
  174. OS::stack_id:
  175. description: The OsNetConfigImpl resource.
  176. value:
  177. get_resource: OsNetConfigImpl