Update the template_version alias for all the templates to pike.
[apex-tripleo-heat-templates.git] / network / ports / net_ip_list_map.yaml
1 heat_template_version: pike
2
3 parameters:
4   ControlPlaneIpList:
5     default: []
6     type: comma_delimited_list
7   ExternalIpList:
8     default: []
9     type: comma_delimited_list
10   InternalApiIpList:
11     default: []
12     type: comma_delimited_list
13   StorageIpList:
14     default: []
15     type: comma_delimited_list
16   StorageMgmtIpList:
17     default: []
18     type: comma_delimited_list
19   TenantIpList:
20     default: []
21     type: comma_delimited_list
22   ManagementIpList:
23     default: []
24     type: comma_delimited_list
25   EnabledServices:
26     default: []
27     type: comma_delimited_list
28   ServiceNetMap:
29     default: {}
30     type: json
31   ServiceHostnameList:
32     default: []
33     type: comma_delimited_list
34   NetworkHostnameMap:
35     default: []
36     type: json
37
38   InternalApiNetName:
39     default: internal_api
40     description: The name of the internal API network.
41     type: string
42   ExternalNetName:
43     default: external
44     description: The name of the external network.
45     type: string
46   ManagementNetName:
47     default: management
48     description: The name of the management network.
49     type: string
50   StorageNetName:
51     default: storage
52     description: The name of the storage network.
53     type: string
54   StorageMgmtNetName:
55     default: storage_mgmt
56     description: The name of the Storage management network.
57     type: string
58   TenantNetName:
59     default: tenant
60     description: The name of the tenant network.
61     type: string
62
63
64 resources:
65    # This adds the extra "services" on for keystone
66    # so that keystone_admin_api_network and
67    # keystone_public_api_network point to the correct
68    # network on the nodes running the "keystone" service
69   EnabledServicesValue:
70     type: OS::Heat::Value
71     properties:
72       type: comma_delimited_list
73       value:
74         yaql:
75           expression: let(root => $) -> $.data.extra_services.items().where($[0] in $root.data.enabled_services).select($[1]).flatten() + $root.data.enabled_services
76           data:
77             enabled_services: {get_param: EnabledServices}
78             extra_services:
79               # If anything other than keystone needs this
80               # then we should add an extra_networks interface
81               # to the service templates role_data but for
82               # now we hard-code the keystone special case
83               keystone:
84                 - keystone_admin_api
85                 - keystone_public_api
86
87   NetIpMapValue:
88     type: OS::Heat::Value
89     properties:
90       type: json
91       value:
92         map_replace:
93           - ctlplane: {get_param: ControlPlaneIpList}
94             external: {get_param: ExternalIpList}
95             internal_api: {get_param: InternalApiIpList}
96             storage: {get_param: StorageIpList}
97             storage_mgmt: {get_param: StorageMgmtIpList}
98             tenant: {get_param: TenantIpList}
99             management: {get_param: ManagementIpList}
100           - keys:
101               external: {get_param: ExternalNetName}
102               internal_api: {get_param: InternalApiNetName}
103               storage: {get_param: StorageNetName}
104               storage_mgmt: {get_param: StorageMgmtNetName}
105               tenant: {get_param: TenantNetName}
106               management: {get_param: ManagementNetName}
107
108 outputs:
109   net_ip_map:
110     description: >
111       A Hash containing a mapping of network names to assigned lists
112       of IP addresses.
113     value: {get_attr: [NetIpMapValue, value]}
114   service_ips:
115     description: >
116       Map of enabled services to a list of their IP addresses
117     value:
118       yaql:
119         # This filters any entries where the value hasn't been substituted for
120         # a list, e.g it's still $service_network.  This happens when there is
121         # no network defined for the service in the ServiceNetMap, which is OK
122         # as not all services have to be bound to a network, so we filter them
123         expression: dict($.data.map.items().where(not isString($[1])))
124         data:
125           map:
126             map_replace:
127               - map_replace:
128                   - map_merge:
129                       repeat:
130                         template:
131                           SERVICE_node_ips: SERVICE_network
132                         for_each:
133                           SERVICE: {get_attr: [EnabledServicesValue, value]}
134                   - values: {get_param: ServiceNetMap}
135               - values: {get_attr: [NetIpMapValue, value]}
136   service_hostnames:
137     description: >
138       Map of enabled services to a list of hostnames where they're running
139     value:
140       map_replace:
141         - yaql:
142             # This filters any entries where the value hasn't been substituted for
143             # a list, e.g it's still $service_network.  This happens when there is
144             # no network defined for the service in the ServiceNetMap, which is OK
145             # as not all services have to be bound to a network, so we filter them
146             expression: dict($.data.map.items().where(not $[1].endsWith("_network")))
147             data:
148               map:
149                 map_replace:
150                   - map_merge:
151                       repeat:
152                         template:
153                           SERVICE_node_names: SERVICE_network
154                         for_each:
155                           SERVICE: {get_attr: [EnabledServicesValue, value]}
156                   - values: {get_param: ServiceNetMap}
157         - values: {get_param: NetworkHostnameMap}
158   short_service_hostnames:
159     description: >
160       Map of enabled services to a list of hostnames where they're running regardless of the network
161     value:
162       yaql:
163         # If ServiceHostnameList is empty the role is deployed with zero nodes
164         # therefore we don't want to add any *_node_names to the map
165         expression: dict($.data.map.items().where(len($[1]) > 0))
166         data:
167           map:
168             map_merge:
169               repeat:
170                 template:
171                   SERVICE_short_node_names: {get_param: ServiceHostnameList}
172                 for_each:
173                     SERVICE: {get_attr: [EnabledServicesValue, value]}
174   short_service_bootstrap_hostnames:
175     description: >
176       Map of enabled services to a list of hostnames where they're running regardless of the network
177       Used for bootstrap purposes
178     value:
179       yaql:
180         # If ServiceHostnameList is empty the role is deployed with zero nodes
181         # therefore we don't want to add any *_node_names to the map
182         expression: dict($.data.map.items().where(len($[1]) > 0))
183         data:
184           map:
185             map_merge:
186               repeat:
187                 template:
188                   SERVICE_short_bootstrap_node_name: {get_param: ServiceHostnameList}
189                 for_each:
190                     SERVICE: {get_attr: [EnabledServicesValue, value]}