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.

695 lines
26KB

  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. {%- set default_image_name = role.ImageDefault|default('overcloud-full') %}
  20. {%- if role.deprecated_param_image is defined %}
  21. {{role.deprecated_param_image}}:
  22. type: string
  23. default: {{default_image_name}}
  24. description: DEPRECATED Use {{role.name}}Image instead
  25. {%- endif %}
  26. {{role.name}}Image:
  27. type: string
  28. default: {{default_image_name}}
  29. description: The disk image file to use for the role.
  30. ImageUpdatePolicy:
  31. default: 'REBUILD_PRESERVE_EPHEMERAL'
  32. description: What policy to use when reconstructing instances. REBUILD for rebuilds, REBUILD_PRESERVE_EPHEMERAL to preserve /mnt.
  33. type: string
  34. KeyName:
  35. description: Name of an existing Nova key pair to enable SSH access to the instances
  36. type: string
  37. default: default
  38. ServiceNetMap:
  39. default: {}
  40. description: Mapping of service_name -> network name. Typically set
  41. via parameter_defaults in the resource registry.
  42. type: json
  43. EndpointMap:
  44. default: {}
  45. description: Mapping of service endpoint -> protocol. Typically set
  46. via parameter_defaults in the resource registry.
  47. type: json
  48. UpdateIdentifier:
  49. default: ''
  50. type: string
  51. description: >
  52. Setting to a previously unused value during stack-update will trigger
  53. package update on all nodes
  54. Hostname:
  55. type: string
  56. default: '' # Defaults to Heat created hostname
  57. HostnameMap:
  58. type: json
  59. default: {}
  60. description: Optional mapping to override hostnames
  61. {{role.name}}IPs:
  62. default: {}
  63. type: json
  64. {%- if role.deprecated_param_ips is defined %}
  65. {{role.deprecated_param_ips}}:
  66. default: {}
  67. description: DEPRECATED - use {{role.name}}IPs instead
  68. type: json
  69. {%- endif %}
  70. SoftwareConfigTransport:
  71. default: POLL_SERVER_CFN
  72. description: |
  73. How the server should receive the metadata required for software configuration.
  74. type: string
  75. constraints:
  76. - allowed_values: [POLL_SERVER_CFN, POLL_SERVER_HEAT, POLL_TEMP_URL, ZAQAR_MESSAGE]
  77. CloudDomain:
  78. default: 'localdomain'
  79. type: string
  80. description: >
  81. The DNS domain used for the hosts. This must match the
  82. overcloud_domain_name configured on the undercloud.
  83. {{role.name}}ServerMetadata:
  84. default: {}
  85. description: >
  86. Extra properties or metadata passed to Nova for the created nodes in
  87. the overcloud. It's accessible via the Nova metadata API. This option is
  88. role-specific and is merged with the values given to the ServerMetadata
  89. parameter.
  90. type: json
  91. {%- if role.deprecated_param_metadata is defined %}
  92. {{role.deprecated_param_metadata}}:
  93. default: {}
  94. description: DEPRECATED - use {{role.name}}ServerMetadata instead
  95. type: json
  96. {%- endif %}
  97. ServerMetadata:
  98. default: {}
  99. description: >
  100. Extra properties or metadata passed to Nova for the created nodes in
  101. the overcloud. It's accessible via the Nova metadata API. This applies to
  102. all roles and is merged with a role-specific metadata parameter.
  103. type: json
  104. {{role.name}}SchedulerHints:
  105. type: json
  106. description: Optional scheduler hints to pass to nova
  107. default: {}
  108. NodeIndex:
  109. type: number
  110. default: 0
  111. ServiceNames:
  112. type: comma_delimited_list
  113. default: []
  114. MonitoringSubscriptions:
  115. type: comma_delimited_list
  116. default: []
  117. ServiceMetadataSettings:
  118. type: json
  119. default: {}
  120. ConfigCommand:
  121. type: string
  122. description: Command which will be run whenever configuration data changes
  123. default: os-refresh-config --timeout 14400
  124. ConfigCollectSplay:
  125. type: number
  126. default: 30
  127. description: |
  128. Maximum amount of time to possibly to delay configuration collection
  129. polling. Defaults to 30 seconds. Set to 0 to disable it which will cause
  130. the configuration collection to occur as soon as the collection process
  131. starts. This setting is used to prevent the configuration collection
  132. processes from polling all at the exact same time.
  133. UpgradeInitCommand:
  134. type: string
  135. description: |
  136. Command or script snippet to run on all overcloud nodes to
  137. initialize the upgrade process. E.g. a repository switch.
  138. default: ''
  139. UpgradeInitCommonCommand:
  140. type: string
  141. description: |
  142. Common commands required by the upgrades process. This should not
  143. normally be modified by the operator and is set and unset in the
  144. major-upgrade-composable-steps.yaml and major-upgrade-converge.yaml
  145. environment files.
  146. default: ''
  147. DeploymentServerBlacklistDict:
  148. default: {}
  149. type: json
  150. description: >
  151. Map of server hostnames to blacklist from any triggered
  152. deployments. If the value is 1, the server will be blacklisted. This
  153. parameter is generated from the parent template.
  154. RoleParameters:
  155. type: json
  156. description: Parameters specific to the role
  157. default: {}
  158. {{role.name}}ControlPlaneSubnet:
  159. default: ctlplane-subnet
  160. description: |
  161. Name of the subnet on ctlplane network for this role.
  162. type: string
  163. ControlPlaneSubnetCidr:
  164. default: ''
  165. description: >
  166. The subnet CIDR of the control plane network. (The parameter is
  167. automatically resolved from the ctlplane subnet's cidr attribute.)
  168. type: string
  169. ControlPlaneDefaultRoute:
  170. default: ''
  171. description: The default route of the control plane network. (The parameter
  172. is automatically resolved from the ctlplane subnet's gateway_ip attribute.)
  173. type: string
  174. ControlPlaneStaticRoutes:
  175. default: []
  176. description: >
  177. Routes for the ctlplane network traffic.
  178. JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
  179. Unless the default is changed, the parameter is automatically resolved
  180. from the subnet host_routes attribute.
  181. type: json
  182. DnsServers: # Override this via parameter_defaults
  183. default: []
  184. description: >
  185. DNS servers to use for the Overcloud (2 max for some implementations).
  186. If not set the nameservers configured in the ctlplane subnet's
  187. dns_nameservers attribute will be used.
  188. type: comma_delimited_list
  189. {%- for network in networks if network.enabled|default(true) and network.name in role.networks|default([]) %}
  190. {{network.name}}InterfaceRoutes:
  191. default: []
  192. description: >
  193. Routes for the {{network.name_lower}} network traffic.
  194. JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
  195. Unless the default is changed, the parameter is automatically resolved
  196. from the subnet host_routes attribute.
  197. type: json
  198. {%- if role.networks is mapping %}
  199. {%- set _subnets = network.get('subnets') %}
  200. {%- set _role_net_subnet = role.networks[network.name].get('subnet') %}
  201. {%- if _subnets and _role_net_subnet and _role_net_subnet in _subnets %}
  202. {{network.name}}NetworkVlanID_{{_role_net_subnet}}:
  203. default: {{network.subnets[_role_net_subnet].vlan|default(1)}}
  204. description: >
  205. Vlan ID for the {{network.name_lower}} network traffic for subnet
  206. {{_role_net_subnet}}.
  207. type: number
  208. {%- elif network.vlan|default(false) %}
  209. {{network.name}}NetworkVlanID:
  210. default: {{network.vlan|default(1)}}
  211. description: Vlan ID for the {{network.name_lower}} network traffic.
  212. type: number
  213. {%- endif %}
  214. {%- elif network.vlan|default(false) %}
  215. {{network.name}}NetworkVlanID:
  216. default: {{network.vlan|default(1)}}
  217. description: Vlan ID for the {{network.name_lower}} network traffic.
  218. type: number
  219. {%- endif %}
  220. {%- endfor %}
  221. ServerDeletionPolicy:
  222. description: Whether to retain or delete servers on deletion of the stack
  223. type: string
  224. default: delete
  225. constraints:
  226. - allowed_values: [delete, retain]
  227. UserData:
  228. type: string
  229. {% if role.uses_deprecated_params|default(false) %}
  230. parameter_groups:
  231. - label: deprecated
  232. description: Do not use deprecated params, they will be removed.
  233. parameters:
  234. {%- for property in role %}
  235. {%- if property.startswith('deprecated_param_') and not role[property].endswith(('SchedulerHints', 'ExtraConfig')) %}
  236. - {{role[property]}}
  237. {%- endif %}
  238. {%- endfor %}
  239. {%- endif %}
  240. conditions:
  241. server_blacklisted:
  242. equals:
  243. - {get_param: [DeploymentServerBlacklistDict, {get_param: Hostname}]}
  244. - 1
  245. server_not_blacklisted:
  246. not:
  247. equals:
  248. - {get_param: [DeploymentServerBlacklistDict, {get_param: Hostname}]}
  249. - 1
  250. {%- if role.deprecated_param_image is defined %}
  251. deprecated_param_image_set:
  252. not:
  253. equals:
  254. - {get_param: {{role.deprecated_param_image}}}
  255. - {{default_image_name}}
  256. {%- endif %}
  257. {%- if role.deprecated_param_flavor is defined %}
  258. deprecated_param_flavor_set:
  259. not:
  260. equals:
  261. - {get_param: {{role.deprecated_param_flavor}}}
  262. - {{default_flavor_name}}
  263. {%- endif %}
  264. ctlplane_fixed_ip_set:
  265. or:
  266. - not:
  267. equals:
  268. - {get_param: [{{role.name}}IPs, 'ctlplane', {get_param: NodeIndex}]}
  269. - ""
  270. {%- if role.deprecated_param_ips %}
  271. - not:
  272. equals:
  273. - {get_param: [{{role.deprecated_param_ips}}, 'ctlplane', {get_param: NodeIndex}]}
  274. - ""
  275. {%- endif %}
  276. - false # NOTE(hjensas): Make sure 'or' get's 2 conditions or more
  277. {%- for network in networks %}
  278. {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
  279. {{role.name}}_{{network.name}}_fixed_ip_set:
  280. not:
  281. equals:
  282. - {get_param: [{{role.name}}IPs, '{{network.name_lower}}', {get_param: NodeIndex}]}
  283. - ''
  284. {{network.name_lower}}_interface_routes_set:
  285. not:
  286. equals:
  287. - {get_param: {{network.name}}InterfaceRoutes}
  288. - []
  289. {%- endif %}
  290. {%- endfor %}
  291. ctlplane_subnet_cidr_set:
  292. not:
  293. equals: [{get_param: ControlPlaneSubnetCidr}, '']
  294. ctlplane_default_route_set:
  295. not:
  296. equals: [{get_param: ControlPlaneDefaultRoute}, '']
  297. ctlplane_static_routes_set:
  298. not:
  299. equals: [{get_param: ControlPlaneStaticRoutes}, []]
  300. dnsservers_set:
  301. not:
  302. equals: [{get_param: DnsServers}, []]
  303. resources:
  304. {{server_resource_name}}:
  305. type: OS::TripleO::{{role.name}}Server
  306. deletion_policy: {get_param: ServerDeletionPolicy}
  307. properties:
  308. image:
  309. {%- if role.deprecated_param_image is defined %}
  310. if:
  311. - deprecated_param_image_set
  312. - {get_param: {{role.deprecated_param_image}}}
  313. - {get_param: {{role.name}}Image}
  314. {%- else %}
  315. get_param: {{role.name}}Image
  316. {%- endif %}
  317. image_update_policy: {get_param: ImageUpdatePolicy}
  318. flavor:
  319. {%- if role.deprecated_param_flavor is defined %}
  320. if:
  321. - deprecated_param_flavor_set
  322. - {get_param: {{role.deprecated_param_flavor}}}
  323. - {get_param: Overcloud{{role.name}}Flavor}
  324. {%- else %}
  325. get_param: Overcloud{{role.name}}Flavor
  326. {%- endif %}
  327. key_name: {get_param: KeyName}
  328. networks:
  329. - if:
  330. - ctlplane_fixed_ip_set
  331. - network: ctlplane
  332. subnet: {get_param: {{role.name}}ControlPlaneSubnet}
  333. fixed_ip:
  334. yaql:
  335. expression: $.data.where(not isEmpty($)).first()
  336. data:
  337. - get_param: [{{role.name}}IPs, 'ctlplane', {get_param: NodeIndex}]
  338. {%- if role.deprecated_param_ips %}
  339. - get_param: [{{role.deprecated_param_ips}}, 'ctlplane', {get_param: NodeIndex}]
  340. {%- endif %}
  341. - network: ctlplane
  342. subnet: {get_param: {{role.name}}ControlPlaneSubnet}
  343. user_data_format: SOFTWARE_CONFIG
  344. user_data: {get_param: UserData}
  345. name:
  346. yaql:
  347. expression: $.data.hostname_map.get($.data.hostname, $.data.hostname).toLower()
  348. data:
  349. hostname: {get_param: Hostname}
  350. hostname_map: {get_param: HostnameMap}
  351. software_config_transport: {get_param: SoftwareConfigTransport}
  352. metadata:
  353. map_merge:
  354. - {get_param: ServerMetadata}
  355. {%- if role.deprecated_param_metadata is defined %}
  356. - {get_param: {{role.deprecated_param_metadata}}}
  357. {%- endif %}
  358. - {get_param: {{role.name}}ServerMetadata}
  359. - {get_param: ServiceMetadataSettings}
  360. scheduler_hints: {get_param: {{role.name}}SchedulerHints}
  361. {%- for network in networks %}
  362. {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
  363. {{network.name}}Port:
  364. type: OS::TripleO::{{role.name}}::Ports::{{network.name}}Port
  365. properties:
  366. PortName:
  367. list_join:
  368. - '_'
  369. - - {get_attr: [{{server_resource_name}}, name]}
  370. - {{network.name}}
  371. ControlPlaneIP: {get_attr: [{{server_resource_name}}, networks, ctlplane, 0]}
  372. FixedIPs:
  373. if:
  374. - {{role.name}}_{{network.name}}_fixed_ip_set
  375. - [{ip_address: {get_param: [{{role.name}}IPs, '{{network.name_lower}}', {get_param: NodeIndex}]}}]
  376. {%- if role.networks is mapping and role.networks.get(network.name) %}
  377. {%- if network.get('service_net_map_replace') == role.networks[network.name].get('subnet').split('_subnet', -1)[0]
  378. and role.networks[network.name].get('subnet').split('_subnet', -1)[0] not in network.get('subnets', {}).keys() %}
  379. - [{subnet: {{network.name_lower + '_subnet'}}}]
  380. {%- else %}
  381. - [{subnet: {{role.networks[network.name].get('subnet', network.name_lower + '_subnet')}}}]
  382. {%- endif %}
  383. {%- else %}
  384. - [{subnet: {{network.name_lower}}_subnet}]
  385. {%- endif %}
  386. ControlPlaneSubnetCidr:
  387. if:
  388. - ctlplane_subnet_cidr_set
  389. - {get_param: ControlPlaneSubnetCidr}
  390. # DeployedServer docs specify 'cidr: 24' in DeployedServerPortMap.
  391. # Support both that, and 'cidr: 192.168.24.0/24'.
  392. - yaql:
  393. expression: str("{0}".format($.data).split("/")[-1])
  394. data: {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, subnets, 0, cidr]}
  395. IPPool:
  396. map_merge:
  397. {%- if role.deprecated_param_ips is defined %}
  398. - {get_param: {{role.deprecated_param_ips}}}
  399. {%- endif %}
  400. - {get_param: {{role.name}}IPs}
  401. NodeIndex: {get_param: NodeIndex}
  402. {%- endif %}
  403. {%- endfor %}
  404. NetworkConfig:
  405. type: OS::TripleO::{{role.name}}::Net::SoftwareConfig
  406. properties:
  407. ControlPlaneIp: "{{ '{{' }} ctlplane_ip {{ '}}' }}"
  408. ControlPlaneSubnetCidr:
  409. if:
  410. - ctlplane_subnet_cidr_set
  411. - {get_param: ControlPlaneSubnetCidr}
  412. - yaql:
  413. expression: str("{0}".format($.data).split("/")[-1])
  414. data: {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, subnets, 0, cidr]}
  415. ControlPlaneDefaultRoute:
  416. if:
  417. - ctlplane_default_route_set
  418. - {get_param: ControlPlaneDefaultRoute}
  419. - {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, subnets, 0, gateway_ip]}
  420. ControlPlaneStaticRoutes:
  421. if:
  422. - ctlplane_static_routes_set
  423. - {get_param: ControlPlaneStaticRoutes}
  424. - yaql:
  425. expression: switch(isList($.data) => $.data, true => [])
  426. data: {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, subnets, 0, host_routes]}
  427. ControlPlaneMtu:
  428. yaql:
  429. expression: switch(isInteger($.data) => $.data, true => 1500)
  430. data: {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, network, mtu]}
  431. DnsServers:
  432. if:
  433. - dnsservers_set
  434. - {get_param: DnsServers}
  435. - {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, subnets, 0, dns_nameservers]}
  436. {%- for network in networks %}
  437. {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
  438. {{network.name}}IpSubnet: "{{ '{{' }} {{network.name_lower}}_ip ~ '/' ~ {{network.name_lower}}_cidr {{ '}}' }}"
  439. {{network.name}}InterfaceRoutes:
  440. if:
  441. - {{network.name_lower}}_interface_routes_set
  442. - {get_param: {{network.name}}InterfaceRoutes}
  443. - {get_attr: [{{network.name}}Port, host_routes]}
  444. {{network.name}}Mtu: {get_attr: [{{network.name}}Port, mtu]}
  445. {%- if network.name in role.default_route_networks %}
  446. {{network.name}}InterfaceDefaultRoute: {get_attr: [{{network.name}}Port, gateway_ip]}
  447. {%- endif %}
  448. {%- if role.networks is mapping %}
  449. {%- set _subnets = network.get('subnets') %}
  450. {%- set _role_net_subnet = role.networks[network.name].get('subnet') %}
  451. {%- if _subnets and _role_net_subnet and _role_net_subnet in _subnets %}
  452. {{network.name}}NetworkVlanID: {get_param: {{network.name}}NetworkVlanID_{{_role_net_subnet}}}
  453. {%- elif network.vlan|default(false) %}
  454. {{network.name}}NetworkVlanID: {get_param: {{network.name}}NetworkVlanID}
  455. {%- endif %}
  456. {%- elif network.vlan|default(false) %}
  457. {{network.name}}NetworkVlanID: {get_param: {{network.name}}NetworkVlanID}
  458. {%- endif %}
  459. {%- endif %}
  460. {%- endfor %}
  461. NetIpMap:
  462. type: OS::TripleO::Network::Ports::NetIpMap
  463. properties:
  464. ControlPlaneIp: {get_attr: [{{server_resource_name}}, networks, ctlplane, 0]}
  465. ControlPlaneSubnetCidr:
  466. if:
  467. - ctlplane_subnet_cidr_set
  468. - {get_param: ControlPlaneSubnetCidr}
  469. - yaql:
  470. expression: str("{0}".format($.data).split("/")[-1])
  471. data: {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, subnets, 0, cidr]}
  472. {%- for network in networks %}
  473. {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
  474. {{network.name}}Ip: {get_attr: [{{network.name}}Port, ip_address]}
  475. {{network.name}}IpSubnet: {get_attr: [{{network.name}}Port, ip_subnet]}
  476. {{network.name}}IpUri: {get_attr: [{{network.name}}Port, ip_address_uri]}
  477. {%- endif %}
  478. {%- endfor %}
  479. NetHostMap:
  480. type: OS::Heat::Value
  481. properties:
  482. type: json
  483. value:
  484. {%- for network in networks %}
  485. {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
  486. {{network.name_lower}}:
  487. fqdn:
  488. list_join:
  489. - '.'
  490. - - {get_attr: [{{server_resource_name}}, name]}
  491. - {{network.name.lower()}}
  492. - {get_param: CloudDomain}
  493. short:
  494. list_join:
  495. - '.'
  496. - - {get_attr: [{{server_resource_name}}, name]}
  497. - {{network.name.lower()}}
  498. {%- endif %}
  499. {%- endfor %}
  500. ctlplane:
  501. fqdn:
  502. list_join:
  503. - '.'
  504. - - {get_attr: [{{server_resource_name}}, name]}
  505. - ctlplane
  506. - {get_param: CloudDomain}
  507. short:
  508. list_join:
  509. - '.'
  510. - - {get_attr: [{{server_resource_name}}, name]}
  511. - ctlplane
  512. canonical:
  513. fqdn:
  514. list_join:
  515. - '.'
  516. - - {get_attr: [{{server_resource_name}}, name]}
  517. - {get_param: CloudDomain}
  518. short:
  519. - {get_attr: [{{server_resource_name}}, name]}
  520. PreNetworkConfig:
  521. type: OS::TripleO::{{role.name}}::PreNetworkConfig
  522. properties:
  523. server: {get_resource: {{server_resource_name}}}
  524. RoleParameters: {get_param: RoleParameters}
  525. ServiceNames: {get_param: ServiceNames}
  526. deployment_actions: {get_attr: [DeploymentActions, value]}
  527. # Resource for site-specific injection of root certificate
  528. NodeTLSCAData:
  529. depends_on: PreNetworkConfig
  530. type: OS::TripleO::NodeTLSCAData
  531. properties:
  532. server: {get_resource: {{server_resource_name}}}
  533. # Hook for site-specific additional pre-deployment config, e.g extra hieradata
  534. {{role.name}}ExtraConfigPre:
  535. type: OS::TripleO::{{role.name}}ExtraConfigPre
  536. # We have to use conditions here so that we don't break backwards
  537. # compatibility with templates everywhere
  538. condition: server_not_blacklisted
  539. properties:
  540. server: {get_resource: {{server_resource_name}}}
  541. # Hook for site-specific additional pre-deployment config,
  542. # applying to all nodes, e.g node registration/unregistration
  543. NodeExtraConfig:
  544. depends_on:
  545. - {{role.name}}ExtraConfigPre
  546. - NodeTLSCAData
  547. type: OS::TripleO::NodeExtraConfig
  548. # We have to use conditions here so that we don't break backwards
  549. # compatibility with templates everywhere
  550. condition: server_not_blacklisted
  551. properties:
  552. server: {get_resource: {{server_resource_name}}}
  553. DeploymentActions:
  554. type: OS::Heat::Value
  555. properties:
  556. value:
  557. if:
  558. - server_not_blacklisted
  559. - ['CREATE', 'UPDATE']
  560. - []
  561. {{server_resource_name}}AnsibleHostVars:
  562. type: OS::Heat::Value
  563. properties:
  564. type: json
  565. value:
  566. {%- for network in networks %}
  567. {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
  568. fqdn_{{network.name_lower}}: {get_attr: [NetHostMap, value, {{network.name_lower}}, fqdn]}
  569. {%- endif %}
  570. {%- endfor %}
  571. fqdn_ctlplane: {get_attr: [NetHostMap, value, ctlplane, fqdn]}
  572. fqdn_canonical: {get_attr: [NetHostMap, value, canonical, fqdn]}
  573. outputs:
  574. ansible_host_vars_map:
  575. description: |
  576. Map of Ansible variables specific per host.
  577. This map is used to construct the AnsibleHostVarsMap output for the
  578. ansible vars per host in config-download.
  579. value:
  580. map_replace:
  581. - host: {get_attr: [{{server_resource_name}}AnsibleHostVars, value]}
  582. - keys:
  583. host: {get_attr: [{{server_resource_name}}, name]}
  584. ip_address:
  585. description: IP address of the server in the ctlplane network
  586. value: {get_attr: [{{server_resource_name}}, networks, ctlplane, 0]}
  587. blacklist_ip_address:
  588. description: IP address of the server if the server is blacklisted, otherwise this output will be an empty string
  589. value:
  590. if:
  591. - server_blacklisted
  592. - {get_attr: [{{server_resource_name}}, networks, ctlplane, 0]}
  593. - ""
  594. blacklist_hostname:
  595. description: Hostname of the server if the server is blacklisted, otherwise this output will be an empty string
  596. value:
  597. if:
  598. - server_blacklisted
  599. - {get_attr: [{{server_resource_name}}, name]}
  600. - ""
  601. hostname:
  602. description: Hostname of the server
  603. value: {get_attr: [{{server_resource_name}}, name]}
  604. hostname_map:
  605. description: Mapping of network names to hostnames
  606. value:
  607. {%- for network in networks %}
  608. {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
  609. {{network.name_lower|default(network.name.lower())}}: {get_attr: [NetHostMap, value, {{network.name_lower|default(network.name.lower()) }}, fqdn]}
  610. {%- endif %}
  611. {%- endfor %}
  612. ctlplane: {get_attr: [NetHostMap, value, ctlplane, fqdn]}
  613. canonical: {get_attr: [NetHostMap, value, canonical, fqdn]}
  614. hostname_network_config_map:
  615. description: Mapping of hostname to NetworkConfig resource
  616. value:
  617. map_replace:
  618. - HOSTNAME: {get_resource: NetworkConfig}
  619. - keys:
  620. HOSTNAME: {get_attr:[{{server_resource_name}}, name]}
  621. hosts_entry:
  622. value:
  623. str_replace:
  624. template: |
  625. PRIMARYIP PRIMARYHOST.DOMAIN PRIMARYHOST
  626. {%- for network in networks %}
  627. {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
  628. {{network.name}}IP {{network.name}}HOST.DOMAIN {{network.name}}HOST
  629. {%- endif %}
  630. {%- endfor %}
  631. CTLPLANEIP CTLPLANEHOST.DOMAIN CTLPLANEHOST
  632. params:
  633. PRIMARYIP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, {{role.name}}HostnameResolveNetwork]}]}
  634. DOMAIN: {get_param: CloudDomain}
  635. PRIMARYHOST: {get_attr: [{{server_resource_name}}, name]}
  636. {%- for network in networks %}
  637. {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
  638. {{network.name}}IP: {get_attr: [{{network.name}}Port, ip_address]}
  639. {{network.name}}HOST: {get_attr: [NetHostMap, value, {{network.name_lower|default(network.name.lower())}}, short]}
  640. {%- endif %}
  641. {%- endfor %}
  642. CTLPLANEIP: {get_attr: [{{server_resource_name}}, networks, ctlplane, 0]}
  643. CTLPLANEHOST: {get_attr: [NetHostMap, value, ctlplane, short]}
  644. nova_server_resource:
  645. description: Heat resource handle for {{role.name}} server
  646. value:
  647. {get_resource: {{server_resource_name}}}
  648. condition: server_not_blacklisted
  649. deployed_server_port_map:
  650. description: |
  651. Map of Heat created hostname of the server to ip address. This is the
  652. hostname before it has been mapped with the HostnameMap parameter, and
  653. the IP address from the ctlplane network. This map can be used to construct
  654. the DeployedServerPortMap parameter when using split-stack.
  655. value:
  656. map_replace:
  657. - hostname:
  658. fixed_ips:
  659. - ip_address: {get_attr: [{{server_resource_name}}, networks, ctlplane, 0]}
  660. subnets:
  661. - cidr: {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, subnets, 0, cidr]}
  662. - keys:
  663. hostname:
  664. list_join:
  665. - '-'
  666. - - {get_param: Hostname}
  667. - ctlplane
  668. {%- for network in networks %}
  669. {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
  670. {{network.name_lower|default(network.name.lower())}}_ip_address:
  671. description: IP address of the server in the {{network.name}} network
  672. value: {get_attr: [{{network.name}}Port, ip_address]}
  673. {%- endif %}
  674. {%- endfor %}