Merge "Add option to specify Certmonger CA"
[apex-tripleo-heat-templates.git] / puppet / all-nodes-config.yaml
1 heat_template_version: 2016-10-14
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   hosts:
16     type: comma_delimited_list
17   # FIXME(shardy) this can be comma_delimited_list when
18   # https://bugs.launchpad.net/heat/+bug/1617019 is fixed
19   enabled_services:
20     type: string
21   controller_ips:
22     type: comma_delimited_list
23   service_ips:
24     type: json
25   service_node_names:
26     type: json
27   controller_names:
28     type: comma_delimited_list
29   memcache_node_ips:
30     type: comma_delimited_list
31   keystone_public_api_node_ips:
32     type: comma_delimited_list
33   keystone_admin_api_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.
57     constraints:
58     - allowed_values: ['CREATE', 'UPDATE']
59   # NOTE(jaosorior): This is being set as IPA as it's the first
60   # CA we'll actually be testing out. But we can change this if
61   # people request it.
62   CertmongerCA:
63     type: string
64     default: 'IPA'
65
66 resources:
67
68   allNodesConfigImpl:
69     type: OS::Heat::StructuredConfig
70     properties:
71       group: os-apply-config
72       config:
73         hosts:
74           list_join:
75           - "\n"
76           - {get_param: hosts}
77         hiera:
78           datafiles:
79             bootstrap_node:
80               mapped_data:
81                 bootstrap_nodeid: {get_input: bootstrap_nodeid}
82                 bootstrap_nodeid_ip: {get_input: bootstrap_nodeid_ip}
83             all_nodes:
84               mapped_data:
85                 map_merge:
86                   - enabled_services: {get_param: enabled_services}
87                   # This writes out a mapping of service_name_enabled: 'true'
88                   # For any services not enabled, hiera foo_enabled will
89                   # return nil, as it's undefined
90                   - map_merge:
91                       repeat:
92                         template:
93                           # Note this must be string 'true' due to
94                           # https://bugs.launchpad.net/heat/+bug/1617203
95                           SERVICE_enabled: 'true'
96                         for_each:
97                           SERVICE:
98                             str_split: [',', {get_param: enabled_services}]
99                   # Dynamically generate per-service network data
100                   # This works as follows (outer->inner functions)
101                   # yaql - filters services where no mapping exists in ServiceNetMap
102                   #   map_replace: substitute e.g heat_api_network with network name from ServiceNetMap
103                   #     map_merge/repeat: generate a per-service mapping
104                   - yaql:
105                       # This filters any entries where the value hasn't been substituted for
106                       # a list, e.g it's still $service_network.  This happens when there is
107                       # no network defined for the service in the ServiceNetMap, which is OK
108                       # as not all services have to be bound to a network, so we filter them
109                       expression: dict($.data.map.items().where(isString($[1]) and not $[1].endsWith("_network")))
110                       data:
111                         map:
112                           map_replace:
113                             - map_merge:
114                                 repeat:
115                                   template:
116                                     SERVICE_network: SERVICE_network
117                                   for_each:
118                                     SERVICE:
119                                       str_split: [',', {get_param: enabled_services}]
120                             - values: {get_param: ServiceNetMap}
121                   # Keystone doesn't provide separate entries for the public
122                   # and admin endpoints, so we need to add them here manually
123                   # like we do in the vip-config below
124                   - keystone_admin_api_network: {get_param: [ServiceNetMap, keystone_admin_api_network]}
125                     keystone_public_api_network: {get_param: [ServiceNetMap, keystone_public_api_network]}
126                   # provides a mapping of service_name_ips to a list of IPs
127                   - {get_param: service_ips}
128                   - {get_param: service_node_names}
129                   - controller_node_ips:
130                       list_join:
131                       - ','
132                       - {get_param: controller_ips}
133                     controller_node_names:
134                       list_join:
135                       - ','
136                       - {get_param: controller_names}
137                     memcached_node_ips_v6:
138                       str_replace:
139                         template: "['inet6:[SERVERS_LIST]']"
140                         params:
141                           SERVERS_LIST:
142                             list_join:
143                             - "]','inet6:["
144                             - {get_param: memcache_node_ips}
145                     keystone_public_api_node_ips:
146                       str_replace:
147                         template: "['SERVERS_LIST']"
148                         params:
149                           SERVERS_LIST:
150                             list_join:
151                             - "','"
152                             - {get_param: keystone_public_api_node_ips}
153                     keystone_admin_api_node_ips:
154                       str_replace:
155                         template: "['SERVERS_LIST']"
156                         params:
157                           SERVERS_LIST:
158                             list_join:
159                             - "','"
160                             - {get_param: keystone_admin_api_node_ips}
161
162                     deploy_identifier: {get_param: DeployIdentifier}
163                     update_identifier: {get_param: UpdateIdentifier}
164                     stack_action: {get_param: StackAction}
165             vip_data:
166               mapped_data:
167                 map_merge:
168                   # Dynamically generate per-service VIP data based on enabled_services
169                   # This works as follows (outer->inner functions)
170                   # yaql - filters services where no mapping exists in ServiceNetMap
171                   #   map_replace: substitute e.g internal_api with the IP from NetVipMap
172                   #     map_replace: substitute e.g heat_api_network with network name from ServiceNetMap
173                   #       map_merge/repeat: generate a per-service mapping
174                   - yaql:
175                       # This filters any entries where the value hasn't been substituted for
176                       # a list, e.g it's still $service_network.  This happens when there is
177                       # no network defined for the service in the ServiceNetMap, which is OK
178                       # as not all services have to be bound to a network, so we filter them
179                       expression: dict($.data.map.items().where(isString($[1]) and not $[1].endsWith("_network")))
180                       data:
181                         map:
182                           map_replace:
183                             - map_replace:
184                                 - map_merge:
185                                     repeat:
186                                       template:
187                                         SERVICE_vip: SERVICE_network
188                                       for_each:
189                                         SERVICE:
190                                           str_split: [',', {get_param: enabled_services}]
191                                 - values: {get_param: ServiceNetMap}
192                             - values: {get_param: NetVipMap}
193                   - keystone_admin_api_vip:
194                       get_param: [NetVipMap, {get_param: [ServiceNetMap, keystone_admin_api_network]}]
195                     keystone_public_api_vip:
196                       get_param: [NetVipMap, {get_param: [ServiceNetMap, keystone_public_api_network]}]
197                     public_virtual_ip: {get_param: [NetVipMap, external]}
198                     controller_virtual_ip: {get_param: [NetVipMap, ctlplane]}
199                     internal_api_virtual_ip: {get_param: [NetVipMap, internal_api]}
200                     storage_virtual_ip: {get_param: [NetVipMap, storage]}
201                     storage_mgmt_virtual_ip: {get_param: [NetVipMap, storage_mgmt]}
202                     redis_vip: {get_param: RedisVirtualIP}
203                     # public_virtual_ip and controller_virtual_ip are needed in
204                     # both HAproxy & keepalived.
205                     tripleo::haproxy::public_virtual_ip: {get_param: [NetVipMap, external]}
206                     tripleo::haproxy::controller_virtual_ip: {get_param: [NetVipMap, ctlplane]}
207                     tripleo::keepalived::public_virtual_ip: {get_param: [NetVipMap, external]}
208                     tripleo::keepalived::controller_virtual_ip: {get_param: [NetVipMap, ctlplane]}
209                     tripleo::keepalived::internal_api_virtual_ip: {get_param: [NetVipMap, internal_api]}
210                     tripleo::keepalived::storage_virtual_ip: {get_param: [NetVipMap, storage]}
211                     tripleo::keepalived::storage_mgmt_virtual_ip: {get_param: [NetVipMap, storage_mgmt]}
212                     tripleo::keepalived::redis_virtual_ip: {get_param: RedisVirtualIP}
213                     tripleo::redis_notification::haproxy_monitor_ip: {get_param: [NetVipMap, ctlplane]}
214                     cloud_name_external: {get_param: cloud_name_external}
215                     cloud_name_internal_api: {get_param: cloud_name_internal_api}
216                     cloud_name_storage: {get_param: cloud_name_storage}
217                     cloud_name_storage_mgmt: {get_param: cloud_name_storage_mgmt}
218                     cloud_name_ctlplane: {get_param: cloud_name_ctlplane}
219                     # TLS parameters
220                     certmonger_ca: {get_param: CertmongerCA}
221
222 outputs:
223   config_id:
224     description: The ID of the allNodesConfigImpl resource.
225     value:
226       {get_resource: allNodesConfigImpl}
227   hosts_entries:
228     description: |
229       The content that should be appended to your /etc/hosts if you want to get
230       hostname-based access to the deployed nodes (useful for testing without
231       setting up a DNS).
232     value: {get_attr: [allNodesConfigImpl, config, hosts]}