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 34KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909
  1. {#- ## Some variables are set to enable rendering backwards compatible templates #}
  2. {#- ## where a few parameter/resource names don't match the expected pattern #}
  3. {#- ## FIXME: we need some way to deprecate the old inconsistent parameters #}
  4. {%- set server_resource_name = role.deprecated_server_resource_name|default(role.name) -%}
  5. heat_template_version: rocky
  6. description: 'OpenStack {{role.name}} node configured by Puppet'
  7. parameters:
  8. {%- set default_flavor_name = role.FlavorDefault|default('baremetal') %}
  9. {%- if role.deprecated_param_flavor is defined %}
  10. {{role.deprecated_param_flavor}}:
  11. description: DEPRECATED Use Overcloud{{role.name}}Flavor instead.
  12. default: {{default_flavor_name}}
  13. type: string
  14. {%- endif %}
  15. Overcloud{{role.name}}Flavor:
  16. description: Flavor for the {{role.name}} node.
  17. default: {{default_flavor_name}}
  18. type: string
  19. {%- if role.disable_constraints is not defined %}
  20. constraints:
  21. - custom_constraint: nova.flavor
  22. {%- endif %}
  23. {%- set default_image_name = role.ImageDefault|default('overcloud-full') %}
  24. {%- if role.deprecated_param_image is defined %}
  25. {{role.deprecated_param_image}}:
  26. type: string
  27. default: {{default_image_name}}
  28. description: DEPRECATED Use {{role.name}}Image instead
  29. {%- endif %}
  30. {{role.name}}Image:
  31. type: string
  32. default: {{default_image_name}}
  33. description: The disk image file to use for the role.
  34. {%- if role.disable_constraints is not defined %}
  35. constraints:
  36. - custom_constraint: glance.image
  37. {%- endif %}
  38. ImageUpdatePolicy:
  39. default: 'REBUILD_PRESERVE_EPHEMERAL'
  40. description: What policy to use when reconstructing instances. REBUILD for rebuilds, REBUILD_PRESERVE_EPHEMERAL to preserve /mnt.
  41. type: string
  42. KeyName:
  43. description: Name of an existing Nova key pair to enable SSH access to the instances
  44. type: string
  45. default: default
  46. {%- if role.disable_constraints is not defined %}
  47. constraints:
  48. - custom_constraint: nova.keypair
  49. {%- endif %}
  50. NeutronPhysicalBridge:
  51. default: 'br-ex'
  52. description: An OVS bridge to create for accessing external networks.
  53. type: string
  54. NeutronPublicInterface:
  55. default: nic1
  56. description: Which interface to add to the NeutronPhysicalBridge.
  57. type: string
  58. ServiceNetMap:
  59. default: {}
  60. description: Mapping of service_name -> network name. Typically set
  61. via parameter_defaults in the resource registry.
  62. type: json
  63. EndpointMap:
  64. default: {}
  65. description: Mapping of service endpoint -> protocol. Typically set
  66. via parameter_defaults in the resource registry.
  67. type: json
  68. UpdateIdentifier:
  69. default: ''
  70. type: string
  71. description: >
  72. Setting to a previously unused value during stack-update will trigger
  73. package update on all nodes
  74. Hostname:
  75. type: string
  76. default: '' # Defaults to Heat created hostname
  77. HostnameMap:
  78. type: json
  79. default: {}
  80. description: Optional mapping to override hostnames
  81. ExtraConfig:
  82. default: {}
  83. description: |
  84. Additional hiera configuration to inject into the cluster. Note
  85. that {{role.name}}ExtraConfig takes precedence over ExtraConfig.
  86. type: json
  87. {{role.name}}ExtraConfig:
  88. default: {}
  89. description: |
  90. Role specific additional hiera configuration to inject into the cluster.
  91. type: json
  92. {%- if role.deprecated_param_extraconfig is defined %}
  93. {{role.deprecated_param_extraconfig}}:
  94. default: {}
  95. description: |
  96. DEPRECATED use {{role.name}}ExtraConfig instead
  97. type: json
  98. {%- endif %}
  99. {{role.name}}IPs:
  100. default: {}
  101. type: json
  102. {%- if role.deprecated_param_ips is defined %}
  103. {{role.deprecated_param_ips}}:
  104. default: {}
  105. description: DEPRECATED - use {{role.name}}IPs instead
  106. type: json
  107. {%- endif %}
  108. {{role.name}}NetworkDeploymentActions:
  109. type: comma_delimited_list
  110. description: >
  111. Heat action when to apply network configuration changes
  112. default: []
  113. NetworkDeploymentActions:
  114. type: comma_delimited_list
  115. description: >
  116. Heat action when to apply network configuration changes
  117. default: ['CREATE']
  118. SoftwareConfigTransport:
  119. default: POLL_SERVER_CFN
  120. description: |
  121. How the server should receive the metadata required for software configuration.
  122. type: string
  123. constraints:
  124. - allowed_values: [POLL_SERVER_CFN, POLL_SERVER_HEAT, POLL_TEMP_URL, ZAQAR_MESSAGE]
  125. CloudDomain:
  126. default: 'localdomain'
  127. type: string
  128. description: >
  129. The DNS domain used for the hosts. This must match the
  130. overcloud_domain_name configured on the undercloud.
  131. {{role.name}}ServerMetadata:
  132. default: {}
  133. description: >
  134. Extra properties or metadata passed to Nova for the created nodes in
  135. the overcloud. It's accessible via the Nova metadata API. This option is
  136. role-specific and is merged with the values given to the ServerMetadata
  137. parameter.
  138. type: json
  139. {%- if role.deprecated_param_metadata is defined %}
  140. {{role.deprecated_param_metadata}}:
  141. default: {}
  142. description: DEPRECATED - use {{role.name}}ServerMetadata instead
  143. type: json
  144. {%- endif %}
  145. ServerMetadata:
  146. default: {}
  147. description: >
  148. Extra properties or metadata passed to Nova for the created nodes in
  149. the overcloud. It's accessible via the Nova metadata API. This applies to
  150. all roles and is merged with a role-specific metadata parameter.
  151. type: json
  152. {{role.name}}SchedulerHints:
  153. type: json
  154. description: Optional scheduler hints to pass to nova
  155. default: {}
  156. NodeIndex:
  157. type: number
  158. default: 0
  159. ServiceConfigSettings:
  160. type: json
  161. default: {}
  162. ServiceNames:
  163. type: comma_delimited_list
  164. default: []
  165. MonitoringSubscriptions:
  166. type: comma_delimited_list
  167. default: []
  168. ServiceMetadataSettings:
  169. type: json
  170. default: {}
  171. ConfigCommand:
  172. type: string
  173. description: Command which will be run whenever configuration data changes
  174. default: os-refresh-config --timeout 14400
  175. ConfigCollectSplay:
  176. type: number
  177. default: 30
  178. description: |
  179. Maximum amount of time to possibly to delay configuration collection
  180. polling. Defaults to 30 seconds. Set to 0 to disable it which will cause
  181. the configuration collection to occur as soon as the collection process
  182. starts. This setting is used to prevent the configuration collection
  183. processes from polling all at the exact same time.
  184. UpgradeInitCommand:
  185. type: string
  186. description: |
  187. Command or script snippet to run on all overcloud nodes to
  188. initialize the upgrade process. E.g. a repository switch.
  189. default: ''
  190. UpgradeInitCommonCommand:
  191. type: string
  192. description: |
  193. Common commands required by the upgrades process. This should not
  194. normally be modified by the operator and is set and unset in the
  195. major-upgrade-composable-steps.yaml and major-upgrade-converge.yaml
  196. environment files.
  197. default: ''
  198. DeploymentServerBlacklistDict:
  199. default: {}
  200. type: json
  201. description: >
  202. Map of server hostnames to blacklist from any triggered
  203. deployments. If the value is 1, the server will be blacklisted. This
  204. parameter is generated from the parent template.
  205. RoleParameters:
  206. type: json
  207. description: Parameters specific to the role
  208. default: {}
  209. DeploymentSwiftDataMap:
  210. type: json
  211. description: |
  212. Map of servers to Swift container and object for storing deployment data.
  213. The keys are the Heat assigned hostnames, and the value is a map of the
  214. container/object name in Swift. Example value:
  215. overcloud-controller-0:
  216. container: overcloud-controller
  217. object: 0
  218. overcloud-controller-1:
  219. container: overcloud-controller
  220. object: 1
  221. overcloud-controller-2:
  222. container: overcloud-controller
  223. object: 2
  224. overcloud-novacompute-0:
  225. container: overcloud-compute
  226. object: 0
  227. default: {}
  228. {{role.name}}ControlPlaneSubnet:
  229. default: ctlplane-subnet
  230. description: |
  231. Name of the subnet on ctlplane network for this role.
  232. type: string
  233. {{role.name}}AnyErrorsFatal:
  234. default: yes
  235. type: string
  236. {#- We generally won't want any failures on HA Controller roles, 15% will cause any 1 node to fail the deploy, #}
  237. {#- for a 3 or 5 node Role, making it a fairly safe default. #}
  238. {{role.name}}MaxFailPercentage:
  239. default: 15
  240. type: number
  241. ControlPlaneSubnetCidr:
  242. default: ''
  243. description: >
  244. The subnet CIDR of the control plane network. (The parameter is
  245. automatically resolved from the ctlplane subnet's cidr attribute.)
  246. type: string
  247. ControlPlaneDefaultRoute:
  248. default: ''
  249. description: The default route of the control plane network. (The parameter
  250. is automatically resolved from the ctlplane subnet's gateway_ip attribute.)
  251. type: string
  252. ControlPlaneStaticRoutes:
  253. default: []
  254. description: >
  255. Routes for the ctlplane network traffic.
  256. JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
  257. Unless the default is changed, the parameter is automatically resolved
  258. from the subnet host_routes attribute.
  259. type: json
  260. EC2MetadataIp:
  261. default: ''
  262. description: The IP address of the EC2 metadata server. (The parameter
  263. is automatically resolved from the ctlplane subnet's host_routes attribute.)
  264. type: string
  265. DnsServers: # Override this via parameter_defaults
  266. default: []
  267. description: >
  268. DNS servers to use for the Overcloud (2 max for some implementations).
  269. If not set the nameservers configured in the ctlplane subnet's
  270. dns_nameservers attribute will be used.
  271. type: comma_delimited_list
  272. {%- for network in networks if network.enabled|default(true) and network.name in role.networks|default([]) %}
  273. {{network.name}}InterfaceRoutes:
  274. default: []
  275. description: >
  276. Routes for the {{network.name_lower}} network traffic.
  277. JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
  278. Unless the default is changed, the parameter is automatically resolved
  279. from the subnet host_routes attribute.
  280. type: json
  281. {%- if role.networks is mapping %}
  282. {%- set _subnets = network.get('subnets') %}
  283. {%- set _role_net_subnet = role.networks[network.name].get('subnet') %}
  284. {%- if _subnets and _role_net_subnet and _role_net_subnet in _subnets %}
  285. {{network.name}}NetworkVlanID_{{_role_net_subnet}}:
  286. default: {{_role_net_subnet.vlan|default(1)}}
  287. description: >
  288. Vlan ID for the {{network.name_lower}} network traffic for subnet
  289. {{_role_net_subnet}}.
  290. type: number
  291. {%- elif network.vlan|default(false) %}
  292. {{network.name}}NetworkVlanID:
  293. default: {{network.vlan|default(1)}}
  294. description: Vlan ID for the {{network.name_lower}} network traffic.
  295. type: number
  296. {%- endif %}
  297. {%- elif network.vlan|default(false) %}
  298. {{network.name}}NetworkVlanID:
  299. default: {{network.vlan|default(1)}}
  300. description: Vlan ID for the {{network.name_lower}} network traffic.
  301. type: number
  302. {%- endif %}
  303. {%- endfor %}
  304. ServerDeletionPolicy:
  305. description: Whether to retain or delete servers on deletion of the stack
  306. type: string
  307. default: delete
  308. constraints:
  309. - allowed_values: [delete, retain]
  310. UserData:
  311. type: string
  312. {% if role.uses_deprecated_params|default(false) %}
  313. parameter_groups:
  314. - label: deprecated
  315. description: Do not use deprecated params, they will be removed.
  316. parameters:
  317. {%- for property in role %}
  318. {%- if property.startswith('deprecated_param_') and not role[property].endswith('SchedulerHints') %}
  319. - {{role[property]}}
  320. {%- endif %}
  321. {%- endfor %}
  322. {%- endif %}
  323. conditions:
  324. server_blacklisted:
  325. equals:
  326. - {get_param: [DeploymentServerBlacklistDict, {get_param: Hostname}]}
  327. - 1
  328. server_not_blacklisted:
  329. not:
  330. equals:
  331. - {get_param: [DeploymentServerBlacklistDict, {get_param: Hostname}]}
  332. - 1
  333. deployment_swift_data_map_unset:
  334. equals:
  335. - get_param:
  336. - DeploymentSwiftDataMap
  337. - {get_param: Hostname}
  338. - ""
  339. {%- if role.deprecated_param_image is defined %}
  340. deprecated_param_image_set:
  341. not:
  342. equals:
  343. - {get_param: {{role.deprecated_param_image}}}
  344. - {{default_image_name}}
  345. {%- endif %}
  346. {%- if role.deprecated_param_flavor is defined %}
  347. deprecated_param_flavor_set:
  348. not:
  349. equals:
  350. - {get_param: {{role.deprecated_param_flavor}}}
  351. - {{default_flavor_name}}
  352. {%- endif %}
  353. role_network_deployment_actions_exists:
  354. not:
  355. equals:
  356. - {get_param: {{role.name}}NetworkDeploymentActions}
  357. - []
  358. ctlplane_fixed_ip_set:
  359. or:
  360. - not:
  361. equals:
  362. - {get_param: [{{role.name}}IPs, 'ctlplane', {get_param: NodeIndex}]}
  363. - ""
  364. {%- if role.deprecated_param_ips %}
  365. - not:
  366. equals:
  367. - {get_param: [{{role.deprecated_param_ips}}, 'ctlplane', {get_param: NodeIndex}]}
  368. - ""
  369. {%- endif %}
  370. - false # NOTE(hjensas): Make sure 'or' get's 2 conditions or more
  371. {%- for network in networks %}
  372. {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
  373. {{role.name}}_{{network.name}}_fixed_ip_set:
  374. not:
  375. equals:
  376. - {get_param: [{{role.name}}IPs, '{{network.name_lower}}', {get_param: NodeIndex}]}
  377. - ''
  378. {{network.name_lower}}_interface_routes_set:
  379. not:
  380. equals:
  381. - {get_param: {{network.name}}InterfaceRoutes}
  382. - []
  383. {%- endif %}
  384. {%- endfor %}
  385. ctlplane_subnet_cidr_set:
  386. not:
  387. equals: [{get_param: ControlPlaneSubnetCidr}, '']
  388. ctlplane_default_route_set:
  389. not:
  390. equals: [{get_param: ControlPlaneDefaultRoute}, '']
  391. ctlplane_static_routes_set:
  392. not:
  393. equals: [{get_param: ControlPlaneStaticRoutes}, []]
  394. ec2metadaip_set:
  395. not:
  396. equals: [{get_param: EC2MetadataIp}, '']
  397. dnsservers_set:
  398. not:
  399. equals: [{get_param: DnsServers}, []]
  400. resources:
  401. {{server_resource_name}}:
  402. type: OS::TripleO::{{role.name}}Server
  403. deletion_policy: {get_param: ServerDeletionPolicy}
  404. properties:
  405. image:
  406. {%- if role.deprecated_param_image is defined %}
  407. if:
  408. - deprecated_param_image_set
  409. - {get_param: {{role.deprecated_param_image}}}
  410. - {get_param: {{role.name}}Image}
  411. {%- else %}
  412. get_param: {{role.name}}Image
  413. {%- endif %}
  414. image_update_policy: {get_param: ImageUpdatePolicy}
  415. flavor:
  416. {%- if role.deprecated_param_flavor is defined %}
  417. if:
  418. - deprecated_param_flavor_set
  419. - {get_param: {{role.deprecated_param_flavor}}}
  420. - {get_param: Overcloud{{role.name}}Flavor}
  421. {%- else %}
  422. get_param: Overcloud{{role.name}}Flavor
  423. {%- endif %}
  424. key_name: {get_param: KeyName}
  425. networks:
  426. - if:
  427. - ctlplane_fixed_ip_set
  428. - network: ctlplane
  429. subnet: {get_param: {{role.name}}ControlPlaneSubnet}
  430. fixed_ip:
  431. yaql:
  432. expression: $.data.where(not isEmpty($)).first()
  433. data:
  434. - get_param: [{{role.name}}IPs, 'ctlplane', {get_param: NodeIndex}]
  435. {%- if role.deprecated_param_ips %}
  436. - get_param: [{{role.deprecated_param_ips}}, 'ctlplane', {get_param: NodeIndex}]
  437. {%- endif %}
  438. - network: ctlplane
  439. subnet: {get_param: {{role.name}}ControlPlaneSubnet}
  440. user_data_format: SOFTWARE_CONFIG
  441. user_data: {get_param: UserData}
  442. name:
  443. yaql:
  444. expression: $.data.hostname_map.get($.data.hostname, $.data.hostname).toLower()
  445. data:
  446. hostname: {get_param: Hostname}
  447. hostname_map: {get_param: HostnameMap}
  448. software_config_transport: {get_param: SoftwareConfigTransport}
  449. metadata:
  450. map_merge:
  451. - {get_param: ServerMetadata}
  452. {%- if role.deprecated_param_metadata is defined %}
  453. - {get_param: {{role.deprecated_param_metadata}}}
  454. {%- endif %}
  455. - {get_param: {{role.name}}ServerMetadata}
  456. - {get_param: ServiceMetadataSettings}
  457. scheduler_hints: {get_param: {{role.name}}SchedulerHints}
  458. deployment_swift_data:
  459. if:
  460. - deployment_swift_data_map_unset
  461. - {}
  462. - {get_param: [DeploymentSwiftDataMap,
  463. {get_param: Hostname}]}
  464. {%- for network in networks %}
  465. {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
  466. {{network.name}}Port:
  467. type: OS::TripleO::{{role.name}}::Ports::{{network.name}}Port
  468. properties:
  469. PortName:
  470. list_join:
  471. - '_'
  472. - - {get_attr: [{{server_resource_name}}, name]}
  473. - {{network.name}}
  474. ControlPlaneIP: {get_attr: [{{server_resource_name}}, networks, ctlplane, 0]}
  475. FixedIPs:
  476. if:
  477. - {{role.name}}_{{network.name}}_fixed_ip_set
  478. - [{ip_address: {get_param: [{{role.name}}IPs, '{{network.name_lower}}', {get_param: NodeIndex}]}}]
  479. {%- if role.networks is mapping and role.networks.get(network.name) %}
  480. {%- if network.get('service_net_map_replace') == role.networks[network.name].get('subnet').split('_subnet', -1)[0]
  481. and role.networks[network.name].get('subnet').split('_subnet', -1)[0] not in network.get('subnets', {}).keys() %}
  482. - [{subnet: {{network.name_lower + '_subnet'}}}]
  483. {%- else %}
  484. - [{subnet: {{role.networks[network.name].get('subnet', network.name_lower + '_subnet')}}}]
  485. {%- endif %}
  486. {%- else %}
  487. - [{subnet: {{network.name_lower}}_subnet}]
  488. {%- endif %}
  489. ControlPlaneSubnetCidr:
  490. if:
  491. - ctlplane_subnet_cidr_set
  492. - {get_param: ControlPlaneSubnetCidr}
  493. # DeployedServer docs specify 'cidr: 24' in DeployedServerPortMap.
  494. # Support both that, and 'cidr: 192.168.24.0/24'.
  495. - yaql:
  496. expression: str("{0}".format($.data).split("/")[-1])
  497. data: {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, subnets, 0, cidr]}
  498. IPPool:
  499. map_merge:
  500. {%- if role.deprecated_param_ips is defined %}
  501. - {get_param: {{role.deprecated_param_ips}}}
  502. {%- endif %}
  503. - {get_param: {{role.name}}IPs}
  504. NodeIndex: {get_param: NodeIndex}
  505. {%- endif %}
  506. {%- endfor %}
  507. NetworkConfig:
  508. type: OS::TripleO::{{role.name}}::Net::SoftwareConfig
  509. properties:
  510. ControlPlaneIp: {get_attr: [{{server_resource_name}}, networks, ctlplane, 0]}
  511. ControlPlaneSubnetCidr:
  512. if:
  513. - ctlplane_subnet_cidr_set
  514. - {get_param: ControlPlaneSubnetCidr}
  515. - yaql:
  516. expression: str("{0}".format($.data).split("/")[-1])
  517. data: {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, subnets, 0, cidr]}
  518. ControlPlaneDefaultRoute:
  519. if:
  520. - ctlplane_default_route_set
  521. - {get_param: ControlPlaneDefaultRoute}
  522. - {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, subnets, 0, gateway_ip]}
  523. ControlPlaneStaticRoutes:
  524. if:
  525. - ctlplane_static_routes_set
  526. - {get_param: ControlPlaneStaticRoutes}
  527. - yaql:
  528. expression: switch(isList($.data) => $.data, true => [])
  529. data: {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, subnets, 0, host_routes]}
  530. ControlPlaneMtu:
  531. yaql:
  532. expression: switch(isInteger($.data) => $.data, true => 1500)
  533. data: {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, network, mtu]}
  534. EC2MetadataIp:
  535. if:
  536. - ec2metadaip_set
  537. - {get_param: EC2MetadataIp}
  538. - yaql:
  539. # NOTE(hjensas): DeployedServer sets the EC2MetadataIp in DeployedServerEnvironment.
  540. # Return an empty string if there are no host_routes in the subnet. (Standalone and Container Undercloud)
  541. expression: switch($.data = null => '', $.data != null => $.data.where($.destination = "169.254.169.254/32").nexthop.first())
  542. data: {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, subnets, 0, host_routes]}
  543. DnsServers:
  544. if:
  545. - dnsservers_set
  546. - {get_param: DnsServers}
  547. - {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, subnets, 0, dns_nameservers]}
  548. {%- for network in networks %}
  549. {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
  550. {{network.name}}IpSubnet: {get_attr: [{{network.name}}Port, ip_subnet]}
  551. {{network.name}}InterfaceRoutes:
  552. if:
  553. - {{network.name_lower}}_interface_routes_set
  554. - {get_param: {{network.name}}InterfaceRoutes}
  555. - {get_attr: [{{network.name}}Port, host_routes]}
  556. {{network.name}}Mtu: {get_attr: [{{network.name}}Port, mtu]}
  557. {%- if network.name in role.default_route_networks %}
  558. {{network.name}}InterfaceDefaultRoute: {get_attr: [{{network.name}}Port, gateway_ip]}
  559. {%- endif %}
  560. {%- if role.networks is mapping %}
  561. {%- set _subnets = network.get('subnets') %}
  562. {%- set _role_net_subnet = role.networks[network.name].get('subnet') %}
  563. {%- if _subnets and _role_net_subnet and _role_net_subnet in _subnets %}
  564. {{network.name}}NetworkVlanID: {get_param: {{network.name}}NetworkVlanID_{{_role_net_subnet}}}
  565. {%- elif network.vlan|default(false) %}
  566. {{network.name}}NetworkVlanID: {get_param: {{network.name}}NetworkVlanID}
  567. {%- endif %}
  568. {%- elif network.vlan|default(false) %}
  569. {{network.name}}NetworkVlanID: {get_param: {{network.name}}NetworkVlanID}
  570. {%- endif %}
  571. {%- endif %}
  572. {%- endfor %}
  573. NetIpMap:
  574. type: OS::TripleO::Network::Ports::NetIpMap
  575. properties:
  576. ControlPlaneIp: {get_attr: [{{server_resource_name}}, networks, ctlplane, 0]}
  577. ControlPlaneSubnetCidr:
  578. if:
  579. - ctlplane_subnet_cidr_set
  580. - {get_param: ControlPlaneSubnetCidr}
  581. - yaql:
  582. expression: str("{0}".format($.data).split("/")[-1])
  583. data: {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, subnets, 0, cidr]}
  584. {%- for network in networks %}
  585. {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
  586. {{network.name}}Ip: {get_attr: [{{network.name}}Port, ip_address]}
  587. {{network.name}}IpSubnet: {get_attr: [{{network.name}}Port, ip_subnet]}
  588. {{network.name}}IpUri: {get_attr: [{{network.name}}Port, ip_address_uri]}
  589. {%- endif %}
  590. {%- endfor %}
  591. NetHostMap:
  592. type: OS::Heat::Value
  593. properties:
  594. type: json
  595. value:
  596. {%- for network in networks %}
  597. {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
  598. {{network.name_lower}}:
  599. fqdn:
  600. list_join:
  601. - '.'
  602. - - {get_attr: [{{server_resource_name}}, name]}
  603. - {{network.name.lower()}}
  604. - {get_param: CloudDomain}
  605. short:
  606. list_join:
  607. - '.'
  608. - - {get_attr: [{{server_resource_name}}, name]}
  609. - {{network.name.lower()}}
  610. {%- endif %}
  611. {%- endfor %}
  612. ctlplane:
  613. fqdn:
  614. list_join:
  615. - '.'
  616. - - {get_attr: [{{server_resource_name}}, name]}
  617. - ctlplane
  618. - {get_param: CloudDomain}
  619. short:
  620. list_join:
  621. - '.'
  622. - - {get_attr: [{{server_resource_name}}, name]}
  623. - ctlplane
  624. canonical:
  625. fqdn:
  626. list_join:
  627. - '.'
  628. - - {get_attr: [{{server_resource_name}}, name]}
  629. - {get_param: CloudDomain}
  630. short:
  631. - {get_attr: [{{server_resource_name}}, name]}
  632. PreNetworkConfig:
  633. type: OS::TripleO::{{role.name}}::PreNetworkConfig
  634. properties:
  635. server: {get_resource: {{server_resource_name}}}
  636. RoleParameters: {get_param: RoleParameters}
  637. ServiceNames: {get_param: ServiceNames}
  638. deployment_actions: {get_attr: [DeploymentActions, value]}
  639. NetworkDeploymentActionsValue:
  640. type: OS::Heat::Value
  641. properties:
  642. value:
  643. - if:
  644. - role_network_deployment_actions_exists
  645. - {get_param: {{role.name}}NetworkDeploymentActions}
  646. - {get_param: NetworkDeploymentActions}
  647. {{server_resource_name}}ConfigDatafiles:
  648. type: OS::Heat::Value
  649. properties:
  650. value:
  651. type: json
  652. datafiles:
  653. service_names:
  654. service_names: {get_param: ServiceNames}
  655. sensu::subscriptions: {get_param: MonitoringSubscriptions}
  656. service_configs: {get_param: ServiceConfigSettings}
  657. {{role.name.lower()}}_extraconfig:
  658. map_merge:
  659. {%- if role.deprecated_param_extraconfig is defined %}
  660. - {get_param: {{role.deprecated_param_extraconfig}}}
  661. {%- endif %}
  662. - {get_param: {{role.name}}ExtraConfig}
  663. extraconfig: {get_param: ExtraConfig}
  664. {{role.name.lower()}}:
  665. tripleo::clouddomain: {get_param: CloudDomain}
  666. # Resource for site-specific injection of root certificate
  667. NodeTLSCAData:
  668. depends_on: PreNetworkConfig
  669. type: OS::TripleO::NodeTLSCAData
  670. properties:
  671. server: {get_resource: {{server_resource_name}}}
  672. # Hook for site-specific additional pre-deployment config, e.g extra hieradata
  673. {{role.name}}ExtraConfigPre:
  674. type: OS::TripleO::{{role.name}}ExtraConfigPre
  675. # We have to use conditions here so that we don't break backwards
  676. # compatibility with templates everywhere
  677. condition: server_not_blacklisted
  678. properties:
  679. server: {get_resource: {{server_resource_name}}}
  680. # Hook for site-specific additional pre-deployment config,
  681. # applying to all nodes, e.g node registration/unregistration
  682. NodeExtraConfig:
  683. depends_on:
  684. - {{role.name}}ExtraConfigPre
  685. - NodeTLSCAData
  686. type: OS::TripleO::NodeExtraConfig
  687. # We have to use conditions here so that we don't break backwards
  688. # compatibility with templates everywhere
  689. condition: server_not_blacklisted
  690. properties:
  691. server: {get_resource: {{server_resource_name}}}
  692. DeploymentActions:
  693. type: OS::Heat::Value
  694. properties:
  695. value:
  696. if:
  697. - server_not_blacklisted
  698. - ['CREATE', 'UPDATE']
  699. - []
  700. SshHostPubKey:
  701. type: OS::TripleO::Ssh::HostPubKey
  702. properties:
  703. server: {get_resource: {{server_resource_name}}}
  704. deployment_actions: {get_attr: [DeploymentActions, value]}
  705. SshKnownHostsHostnames:
  706. type: OS::Heat::Value
  707. properties:
  708. value:
  709. str_replace:
  710. template: "[PRIMARYIP]*,[PRIMARYHOST.DOMAIN]*,[PRIMARYHOST]*,\
  711. {%- for network in networks %}
  712. {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
  713. [{{network.name}}IP]*,[{{network.name}}HOST.DOMAIN]*,\
  714. [{{network.name}}HOST]*,\
  715. {%- endif %}
  716. {%- endfor %}
  717. [CTLPLANEIP]*,[CTLPLANEHOST.DOMAIN]*,[CTLPLANEHOST]*"
  718. params:
  719. PRIMARYIP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, {{role.name}}HostnameResolveNetwork]}]}
  720. DOMAIN: {get_param: CloudDomain}
  721. PRIMARYHOST: {get_attr: [{{server_resource_name}}, name]}
  722. {%- for network in networks %}
  723. {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
  724. {{network.name}}IP: {get_attr: [{{network.name}}Port, ip_address]}
  725. {{network.name}}HOST: {get_attr: [NetHostMap, value, {{network.name_lower|default(network.name.lower())}}, short]}
  726. {%- endif %}
  727. {%- endfor %}
  728. CTLPLANEIP: {get_attr: [{{server_resource_name}}, networks, ctlplane, 0]}
  729. CTLPLANEHOST: {get_attr: [NetHostMap, value, ctlplane, short]}
  730. {{server_resource_name}}AnsibleHostVars:
  731. type: OS::Heat::Value
  732. properties:
  733. type: json
  734. value:
  735. {%- for network in networks %}
  736. {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
  737. fqdn_{{network.name_lower}}: {get_attr: [NetHostMap, value, {{network.name_lower}}, fqdn]}
  738. {%- endif %}
  739. {%- endfor %}
  740. fqdn_ctlplane: {get_attr: [NetHostMap, value, ctlplane, fqdn]}
  741. fqdn_canonical: {get_attr: [NetHostMap, value, canonical, fqdn]}
  742. {{server_resource_name}}PerHostHieradata:
  743. type: OS::Heat::Value
  744. properties:
  745. type: json
  746. value:
  747. datafiles:
  748. host_extraconfig: {get_attr: [{{server_resource_name}}AnsibleHostVars, value]}
  749. net_ip_map: {get_attr: [NetIpMap, net_ip_map]}
  750. outputs:
  751. ansible_host_vars_map:
  752. description: |
  753. Map of Ansible variables specific per host.
  754. This map is used to construct the AnsibleHostVarsMap output for the
  755. ansible vars per host in config-download.
  756. value:
  757. map_replace:
  758. - host: {get_attr: [{{server_resource_name}}AnsibleHostVars, value]}
  759. - keys:
  760. host: {get_attr: [{{server_resource_name}}, name]}
  761. per_host_hieradata_map:
  762. description: |
  763. Map of Hieradata specific per host.
  764. value:
  765. map_replace:
  766. - host: {get_attr: [{{server_resource_name}}PerHostHieradata, value]}
  767. - keys:
  768. host: {get_attr: [{{server_resource_name}}, name]}
  769. config_datafiles:
  770. description: The config in the full format with datafiles section.
  771. value: {get_attr: [{{server_resource_name}}ConfigDatafiles, value]}
  772. ip_address:
  773. description: IP address of the server in the ctlplane network
  774. value: {get_attr: [{{server_resource_name}}, networks, ctlplane, 0]}
  775. blacklist_ip_address:
  776. description: IP address of the server if the server is blacklisted, otherwise this output will be an empty string
  777. value:
  778. if:
  779. - server_blacklisted
  780. - {get_attr: [{{server_resource_name}}, networks, ctlplane, 0]}
  781. - ""
  782. blacklist_hostname:
  783. description: Hostname of the server if the server is blacklisted, otherwise this output will be an empty string
  784. value:
  785. if:
  786. - server_blacklisted
  787. - {get_attr: [{{server_resource_name}}, name]}
  788. - ""
  789. hostname:
  790. description: Hostname of the server
  791. value: {get_attr: [{{server_resource_name}}, name]}
  792. hostname_map:
  793. description: Mapping of network names to hostnames
  794. value:
  795. {%- for network in networks %}
  796. {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
  797. {{network.name_lower|default(network.name.lower())}}: {get_attr: [NetHostMap, value, {{network.name_lower|default(network.name.lower()) }}, fqdn]}
  798. {%- endif %}
  799. {%- endfor %}
  800. ctlplane: {get_attr: [NetHostMap, value, ctlplane, fqdn]}
  801. canonical: {get_attr: [NetHostMap, value, canonical, fqdn]}
  802. hostname_network_config_map:
  803. description: Mapping of hostname to NetworkConfig resource
  804. value:
  805. map_replace:
  806. - HOSTNAME: {get_resource: NetworkConfig}
  807. - keys:
  808. HOSTNAME: {get_attr:[{{server_resource_name}}, name]}
  809. hosts_entry:
  810. value:
  811. str_replace:
  812. template: |
  813. PRIMARYIP PRIMARYHOST.DOMAIN PRIMARYHOST
  814. {%- for network in networks %}
  815. {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
  816. {{network.name}}IP {{network.name}}HOST.DOMAIN {{network.name}}HOST
  817. {%- endif %}
  818. {%- endfor %}
  819. CTLPLANEIP CTLPLANEHOST.DOMAIN CTLPLANEHOST
  820. params:
  821. PRIMARYIP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, {{role.name}}HostnameResolveNetwork]}]}
  822. DOMAIN: {get_param: CloudDomain}
  823. PRIMARYHOST: {get_attr: [{{server_resource_name}}, name]}
  824. {%- for network in networks %}
  825. {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
  826. {{network.name}}IP: {get_attr: [{{network.name}}Port, ip_address]}
  827. {{network.name}}HOST: {get_attr: [NetHostMap, value, {{network.name_lower|default(network.name.lower())}}, short]}
  828. {%- endif %}
  829. {%- endfor %}
  830. CTLPLANEIP: {get_attr: [{{server_resource_name}}, networks, ctlplane, 0]}
  831. CTLPLANEHOST: {get_attr: [NetHostMap, value, ctlplane, short]}
  832. known_hosts_entry:
  833. description: Entry for ssh known hosts
  834. value:
  835. list_join:
  836. - ' '
  837. - - {get_attr: [SshKnownHostsHostnames, value]}
  838. - {get_attr: [SshHostPubKey, ecdsa]}
  839. known_hosts_hostnames:
  840. description: Mapping of server name to hostnames portion of ssh known hosts entry
  841. value:
  842. map_replace:
  843. - name: {get_attr: [SshKnownHostsHostnames, value]}
  844. - keys:
  845. name: {get_attr: [{{server_resource_name}}, name]}
  846. nova_server_resource:
  847. description: Heat resource handle for {{role.name}} server
  848. value:
  849. {get_resource: {{server_resource_name}}}
  850. condition: server_not_blacklisted
  851. deployed_server_port_map:
  852. description: |
  853. Map of Heat created hostname of the server to ip address. This is the
  854. hostname before it has been mapped with the HostnameMap parameter, and
  855. the IP address from the ctlplane network. This map can be used to construct
  856. the DeployedServerPortMap parameter when using split-stack.
  857. value:
  858. map_replace:
  859. - hostname:
  860. fixed_ips:
  861. - ip_address: {get_attr: [{{server_resource_name}}, networks, ctlplane, 0]}
  862. subnets:
  863. - cidr: {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, subnets, 0, cidr]}
  864. - keys:
  865. hostname:
  866. list_join:
  867. - '-'
  868. - - {get_param: Hostname}
  869. - ctlplane
  870. {%- for network in networks %}
  871. {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
  872. {{network.name_lower|default(network.name.lower())}}_ip_address:
  873. description: IP address of the server in the {{network.name}} network
  874. value: {get_attr: [{{network.name}}Port, ip_address]}
  875. {%- endif %}
  876. {%- endfor %}
  877. role_group_vars:
  878. value:
  879. any_errors_fatal: {get_param: {{role.name}}AnyErrorsFatal}
  880. max_fail_percentage: {get_param: {{role.name}}MaxFailPercentage}
  881. neutron_physical_bridge_name: {get_param: NeutronPhysicalBridge}
  882. neutron_public_interface_name: {get_param: NeutronPublicInterface}
  883. network_deployment_actions: {get_attr: [NetworkDeploymentActionsValue, value]}