Merge "Setting networking-odl v2 as a mechanism driver"
[apex-tripleo-heat-templates.git] / network / ports / net_ip_list_map.yaml
1 heat_template_version: ocata
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 resources:
39    # This adds the extra "services" on for keystone
40    # so that keystone_admin_api_network and
41    # keystone_public_api_network point to the correct
42    # network on the nodes running the "keystone" service
43   EnabledServicesValue:
44     type: OS::Heat::Value
45     properties:
46       type: comma_delimited_list
47       value:
48         yaql:
49           expression: let(root => $) -> $.data.extra_services.items().where($[0] in $root.data.enabled_services).select($[1]).flatten() + $root.data.enabled_services
50           data:
51             enabled_services: {get_param: EnabledServices}
52             extra_services:
53               # If anything other than keystone needs this
54               # then we should add an extra_networks interface
55               # to the service templates role_data but for
56               # now we hard-code the keystone special case
57               keystone:
58                 - keystone_admin_api
59                 - keystone_public_api
60
61 outputs:
62   net_ip_map:
63     description: >
64       A Hash containing a mapping of network names to assigned lists
65       of IP addresses.
66     value:
67       ctlplane: {get_param: ControlPlaneIpList}
68       external: {get_param: ExternalIpList}
69       internal_api: {get_param: InternalApiIpList}
70       storage: {get_param: StorageIpList}
71       storage_mgmt: {get_param: StorageMgmtIpList}
72       tenant: {get_param: TenantIpList}
73       management: {get_param: ManagementIpList}
74   service_ips:
75     description: >
76       Map of enabled services to a list of their IP addresses
77     value:
78       yaql:
79         # This filters any entries where the value hasn't been substituted for
80         # a list, e.g it's still $service_network.  This happens when there is
81         # no network defined for the service in the ServiceNetMap, which is OK
82         # as not all services have to be bound to a network, so we filter them
83         expression: dict($.data.map.items().where(not isString($[1])))
84         data:
85           map:
86             map_replace:
87               - map_replace:
88                   - map_merge:
89                       repeat:
90                         template:
91                           SERVICE_node_ips: SERVICE_network
92                         for_each:
93                           SERVICE: {get_attr: [EnabledServicesValue, value]}
94                   - values: {get_param: ServiceNetMap}
95               - values:
96                   ctlplane: {get_param: ControlPlaneIpList}
97                   external: {get_param: ExternalIpList}
98                   internal_api: {get_param: InternalApiIpList}
99                   storage: {get_param: StorageIpList}
100                   storage_mgmt: {get_param: StorageMgmtIpList}
101                   tenant: {get_param: TenantIpList}
102                   management: {get_param: ManagementIpList}
103   service_hostnames:
104     description: >
105       Map of enabled services to a list of hostnames where they're running
106     value:
107       map_replace:
108         - yaql:
109             # This filters any entries where the value hasn't been substituted for
110             # a list, e.g it's still $service_network.  This happens when there is
111             # no network defined for the service in the ServiceNetMap, which is OK
112             # as not all services have to be bound to a network, so we filter them
113             expression: dict($.data.map.items().where(not $[1].endsWith("_network")))
114             data:
115               map:
116                 map_replace:
117                   - map_merge:
118                       repeat:
119                         template:
120                           SERVICE_node_names: SERVICE_network
121                         for_each:
122                           SERVICE: {get_attr: [EnabledServicesValue, value]}
123                   - values: {get_param: ServiceNetMap}
124         - values: {get_param: NetworkHostnameMap}
125   short_service_hostnames:
126     description: >
127       Map of enabled services to a list of hostnames where they're running regardless of the network
128     value:
129       yaql:
130         # If ServiceHostnameList is empty the role is deployed with zero nodes
131         # therefore we don't want to add any *_node_names to the map
132         expression: dict($.data.map.items().where(len($[1]) > 0))
133         data:
134           map:
135             map_merge:
136               repeat:
137                 template:
138                   SERVICE_short_node_names: {get_param: ServiceHostnameList}
139                 for_each:
140                     SERVICE: {get_attr: [EnabledServicesValue, value]}
141   short_service_bootstrap_hostnames:
142     description: >
143       Map of enabled services to a list of hostnames where they're running regardless of the network
144       Used for bootstrap purposes
145     value:
146       yaql:
147         # If ServiceHostnameList is empty the role is deployed with zero nodes
148         # therefore we don't want to add any *_node_names to the map
149         expression: dict($.data.map.items().where(len($[1]) > 0))
150         data:
151           map:
152             map_merge:
153               repeat:
154                 template:
155                   SERVICE_short_bootstrap_node_name: {get_param: ServiceHostnameList}
156                 for_each:
157                     SERVICE: {get_attr: [EnabledServicesValue, value]}