bc9a272055bbbe5ed2d6b1184bb87fd987d008ee
[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   hosts:
6     type: comma_delimited_list
7   # FIXME(shardy) this can be comma_delimited_list when
8   # https://bugs.launchpad.net/heat/+bug/1617019 is fixed
9   enabled_services:
10     type: string
11   controller_ips:
12     type: comma_delimited_list
13   service_ips:
14     type: json
15   service_node_names:
16     type: json
17   controller_names:
18     type: comma_delimited_list
19   memcache_node_ips:
20     type: comma_delimited_list
21   keystone_public_api_node_ips:
22     type: comma_delimited_list
23   keystone_admin_api_node_ips:
24     type: comma_delimited_list
25   DeployIdentifier:
26     type: string
27     default: ''
28     description: >
29       Setting this to a unique value will re-run any deployment tasks which
30       perform configuration on a Heat stack-update.
31   UpdateIdentifier:
32     type: string
33     description: >
34       Setting to a previously unused value during stack-update will trigger
35       package update on all nodes
36   StackAction:
37     type: string
38     description: >
39       Heat action on performed top-level stack.
40     constraints:
41     - allowed_values: ['CREATE', 'UPDATE']
42
43 resources:
44
45   allNodesConfigImpl:
46     type: OS::Heat::StructuredConfig
47     properties:
48       group: os-apply-config
49       config:
50         hosts:
51           list_join:
52           - "\n"
53           - {get_param: hosts}
54         hiera:
55           datafiles:
56             bootstrap_node:
57               mapped_data:
58                 bootstrap_nodeid: {get_input: bootstrap_nodeid}
59                 bootstrap_nodeid_ip: {get_input: bootstrap_nodeid_ip}
60             all_nodes:
61               mapped_data:
62                 map_merge:
63                   - enabled_services: {get_param: enabled_services}
64                   # This writes out a mapping of service_name_enabled: 'true'
65                   # For any services not enabled, hiera foo_enabled will
66                   # return nil, as it's undefined
67                   - map_merge:
68                       repeat:
69                         template:
70                           # Note this must be string 'true' due to
71                           # https://bugs.launchpad.net/heat/+bug/1617203
72                           SERVICE_enabled: 'true'
73                         for_each:
74                           SERVICE:
75                             str_split: [',', {get_param: enabled_services}]
76                   # provides a mapping of service_name_ips to a list of IPs
77                   - {get_param: service_ips}
78                   - {get_param: service_node_names}
79                   - controller_node_ips:
80                       list_join:
81                       - ','
82                       - {get_param: controller_ips}
83                     controller_node_names:
84                       list_join:
85                       - ','
86                       - {get_param: controller_names}
87                     memcached_node_ips_v6:
88                       str_replace:
89                         template: "['inet6:[SERVERS_LIST]']"
90                         params:
91                           SERVERS_LIST:
92                             list_join:
93                             - "]','inet6:["
94                             - {get_param: memcache_node_ips}
95                     keystone_public_api_node_ips:
96                       str_replace:
97                         template: "['SERVERS_LIST']"
98                         params:
99                           SERVERS_LIST:
100                             list_join:
101                             - "','"
102                             - {get_param: keystone_public_api_node_ips}
103                     keystone_admin_api_node_ips:
104                       str_replace:
105                         template: "['SERVERS_LIST']"
106                         params:
107                           SERVERS_LIST:
108                             list_join:
109                             - "','"
110                             - {get_param: keystone_admin_api_node_ips}
111
112                     deploy_identifier: {get_param: DeployIdentifier}
113                     update_identifier: {get_param: UpdateIdentifier}
114                     stack_action: {get_param: StackAction}
115
116 outputs:
117   config_id:
118     description: The ID of the allNodesConfigImpl resource.
119     value:
120       {get_resource: allNodesConfigImpl}
121   hosts_entries:
122     description: |
123       The content that should be appended to your /etc/hosts if you want to get
124       hostname-based access to the deployed nodes (useful for testing without
125       setting up a DNS).
126     value: {get_attr: [allNodesConfigImpl, config, hosts]}