Merge "Remove trailing whitespace"
[apex-tripleo-heat-templates.git] / puppet / all-nodes-config.yaml
1 heat_template_version: pike
2 description: 'All Nodes Config for Puppet'
3
4 parameters:
5   cloud_name_external:
6     type: string
7   cloud_name_internal_api:
8     type: string
9   cloud_name_storage:
10     type: string
11   cloud_name_storage_mgmt:
12     type: string
13   cloud_name_ctlplane:
14     type: string
15   enabled_services:
16     type: comma_delimited_list
17   controller_ips:
18     type: comma_delimited_list
19   logging_groups:
20     type: json
21   logging_sources:
22     type: json
23   service_ips:
24     type: json
25   service_node_names:
26     type: json
27   short_service_node_names:
28     type: json
29   short_service_bootstrap_node:
30     type: json
31   controller_names:
32     type: comma_delimited_list
33   memcache_node_ips:
34     type: comma_delimited_list
35   NetVipMap:
36     type: json
37   RedisVirtualIP:
38     type: string
39     default: ''
40   ServiceNetMap:
41     type: json
42   DeployIdentifier:
43     type: string
44     default: ''
45     description: >
46       Setting this to a unique value will re-run any deployment tasks which
47       perform configuration on a Heat stack-update.
48   UpdateIdentifier:
49     type: string
50     description: >
51       Setting to a previously unused value during stack-update will trigger
52       package update on all nodes
53   StackAction:
54     type: string
55     description: >
56       Heat action on performed top-level stack.  Note StackUpdateType is
57       set to UPGRADE when a major-version upgrade is in progress.
58     constraints:
59     - allowed_values: ['CREATE', 'UPDATE']
60   StackUpdateType:
61     type: string
62     description: >
63       Type of update, to differentiate between UPGRADE and UPDATE cases
64       when StackAction is UPDATE (both are the same stack action).
65     constraints:
66     - allowed_values: ['', 'UPGRADE']
67     default: ''
68   # NOTE(jaosorior): This is being set as IPA as it's the first
69   # CA we'll actually be testing out. But we can change this if
70   # people request it.
71   CertmongerCA:
72     type: string
73     default: 'IPA'
74   EnableInternalTLS:
75     type: boolean
76     default: false
77
78   InternalApiNetName:
79     default: internal_api
80     description: The name of the internal API network.
81     type: string
82   ExternalNetName:
83     default: external
84     description: The name of the external network.
85     type: string
86   ManagementNetName:
87     default: management
88     description: The name of the management network.
89     type: string
90   StorageNetName:
91     default: storage
92     description: The name of the storage network.
93     type: string
94   StorageMgmtNetName:
95     default: storage_mgmt
96     description: The name of the Storage management network.
97     type: string
98   TenantNetName:
99     default: tenant
100     description: The name of the tenant network.
101     type: string
102
103
104 resources:
105
106   allNodesConfigImpl:
107     type: OS::Heat::StructuredConfig
108     properties:
109       group: hiera
110       config:
111         datafiles:
112           bootstrap_node:
113             bootstrap_nodeid: {get_input: bootstrap_nodeid}
114             bootstrap_nodeid_ip: {get_input: bootstrap_nodeid_ip}
115           all_nodes:
116            map_merge:
117               - tripleo::profile::base::logging::fluentd::fluentd_sources: {get_param: logging_sources}
118               - tripleo::profile::base::logging::fluentd::fluentd_groups: {get_param: logging_groups}
119               - enabled_services:
120                   yaql:
121                     expression: $.data.distinct()
122                     data: {get_param: enabled_services}
123               # This writes out a mapping of service_name_enabled: 'true'
124               # For any services not enabled, hiera foo_enabled will
125               # return nil, as it's undefined
126               - map_merge:
127                   repeat:
128                     template:
129                       # Note this must be string 'true' due to
130                       # https://bugs.launchpad.net/heat/+bug/1617203
131                       SERVICE_enabled: 'true'
132                     for_each:
133                       SERVICE: {get_param: enabled_services}
134               # Dynamically generate per-service network data
135               # This works as follows (outer->inner functions)
136               # yaql - filters services where no mapping exists in ServiceNetMap
137               #   map_replace: substitute e.g heat_api_network with network name from ServiceNetMap
138               #     map_merge/repeat: generate a per-service mapping
139               - yaql:
140                   # This filters any entries where the value hasn't been substituted for
141                   # a list, e.g it's still $service_network.  This happens when there is
142                   # no network defined for the service in the ServiceNetMap, which is OK
143                   # as not all services have to be bound to a network, so we filter them
144                   expression: dict($.data.map.items().where(isString($[1]) and not $[1].endsWith("_network")))
145                   data:
146                     map:
147                       map_replace:
148                         - map_merge:
149                             repeat:
150                               template:
151                                 SERVICE_network: SERVICE_network
152                               for_each:
153                                 SERVICE: {get_param: enabled_services}
154                         - values: {get_param: ServiceNetMap}
155               # Keystone doesn't provide separate entries for the public
156               # and admin endpoints, so we need to add them here manually
157               # like we do in the vip-config below
158               - keystone_admin_api_network: {get_param: [ServiceNetMap, keystone_admin_api_network]}
159                 keystone_public_api_network: {get_param: [ServiceNetMap, keystone_public_api_network]}
160               # provides a mapping of service_name_ips to a list of IPs
161               - {get_param: service_ips}
162               - {get_param: service_node_names}
163               - {get_param: short_service_node_names}
164               - {get_param: short_service_bootstrap_node}
165               - controller_node_ips:
166                   list_join:
167                   - ','
168                   - {get_param: controller_ips}
169                 controller_node_names:
170                   list_join:
171                   - ','
172                   - {get_param: controller_names}
173                 memcached_node_ips_v6:
174                   repeat:
175                     template: "inet6:[NAME]"
176                     for_each:
177                       NAME: {get_param: memcache_node_ips}
178                 deploy_identifier: {get_param: DeployIdentifier}
179                 update_identifier: {get_param: UpdateIdentifier}
180                 stack_action: {get_param: StackAction}
181                 stack_update_type: {get_param: StackUpdateType}
182           vip_data:
183             map_merge:
184               # Dynamically generate per-service VIP data based on enabled_services
185               # This works as follows (outer->inner functions)
186               # yaql - filters services where no mapping exists in ServiceNetMap
187               #   map_replace: substitute e.g internal_api with the IP from NetVipMap
188               #     map_replace: substitute e.g heat_api_network with network name from ServiceNetMap
189               #       map_merge/repeat: generate a per-service mapping
190               - yaql:
191                   # This filters any entries where the value hasn't been substituted for
192                   # a list, e.g it's still $service_network.  This happens when there is
193                   # no network defined for the service in the ServiceNetMap, which is OK
194                   # as not all services have to be bound to a network, so we filter them
195                   expression: dict($.data.map.items().where(isString($[1]) and not $[1].endsWith("_network")))
196                   data:
197                     map:
198                       map_replace:
199                         - map_replace:
200                             - map_merge:
201                                 repeat:
202                                   template:
203                                     SERVICE_vip: SERVICE_network
204                                   for_each:
205                                     SERVICE: {get_param: enabled_services}
206                             - values: {get_param: ServiceNetMap}
207                         - values: {get_param: NetVipMap}
208               - keystone_admin_api_vip:
209                   get_param: [NetVipMap, {get_param: [ServiceNetMap, keystone_admin_api_network]}]
210                 keystone_public_api_vip:
211                   get_param: [NetVipMap, {get_param: [ServiceNetMap, keystone_public_api_network]}]
212                 public_virtual_ip: {get_param: [NetVipMap, {get_param: ExternalNetName}]}
213                 controller_virtual_ip: {get_param: [NetVipMap, ctlplane]}
214                 internal_api_virtual_ip: {get_param: [NetVipMap, {get_param: InternalApiNetName}]}
215                 storage_virtual_ip: {get_param: [NetVipMap, {get_param: StorageNetName}]}
216                 storage_mgmt_virtual_ip: {get_param: [NetVipMap, {get_param: StorageMgmtNetName}]}
217                 redis_vip: {get_param: RedisVirtualIP}
218                 # public_virtual_ip and controller_virtual_ip are needed in
219                 # both HAproxy & keepalived.
220                 tripleo::haproxy::public_virtual_ip: {get_param: [NetVipMap, {get_param: ExternalNetName}]}
221                 tripleo::haproxy::controller_virtual_ip: {get_param: [NetVipMap, ctlplane]}
222                 tripleo::keepalived::public_virtual_ip: {get_param: [NetVipMap, {get_param: ExternalNetName}]}
223                 tripleo::keepalived::controller_virtual_ip: {get_param: [NetVipMap, ctlplane]}
224                 tripleo::keepalived::internal_api_virtual_ip: {get_param: [NetVipMap, {get_param: InternalApiNetName}]}
225                 tripleo::keepalived::storage_virtual_ip: {get_param: [NetVipMap, {get_param: StorageNetName}]}
226                 tripleo::keepalived::storage_mgmt_virtual_ip: {get_param: [NetVipMap, {get_param: StorageMgmtNetName}]}
227                 tripleo::keepalived::redis_virtual_ip: {get_param: RedisVirtualIP}
228                 tripleo::redis_notification::haproxy_monitor_ip: {get_param: [NetVipMap, ctlplane]}
229                 cloud_name_external: {get_param: cloud_name_external}
230                 cloud_name_internal_api: {get_param: cloud_name_internal_api}
231                 cloud_name_storage: {get_param: cloud_name_storage}
232                 cloud_name_storage_mgmt: {get_param: cloud_name_storage_mgmt}
233                 cloud_name_ctlplane: {get_param: cloud_name_ctlplane}
234                 # TLS parameters
235                 certmonger_ca: {get_param: CertmongerCA}
236                 enable_internal_tls: {get_param: EnableInternalTLS}
237
238 outputs:
239   config_id:
240     description: The ID of the allNodesConfigImpl resource.
241     value:
242       {get_resource: allNodesConfigImpl}