Merge "Refactor setup_docker_host.sh as host_prep_tasks"
[apex-tripleo-heat-templates.git] / network / ports / net_ip_map.j2.yaml
1 heat_template_version: pike
2
3 parameters:
4   ControlPlaneIp:
5     default: ''
6     type: string
7   ControlPlaneSubnetCidr: # Override this via parameter_defaults
8     default: '24'
9     description: The subnet CIDR of the control plane network.
10     type: string
11 {%- for network in networks %}
12   {{network.name}}Ip:
13     default: ''
14     type: string
15   {{network.name}}IpSubnet:
16     description: 'IP address/subnet on the {{network.name_lower}} network'
17     default: ''
18     type: string
19   {{network.name}}IpUri:
20     default: ''
21     type: string
22     description: IP address with brackets in case of IPv6
23 {%- endfor %}
24
25 {%- for network in networks %}
26   {{network.name}}NetName:
27     default: {{network.name_lower}}
28     description: The name of the {{network.name_lower}} network.
29     type: string
30 {%- endfor %}
31
32 resources:
33
34   NetIpMapValue:
35     type: OS::Heat::Value
36     properties:
37       type: json
38       value:
39         map_replace:
40           - ctlplane: {get_param: ControlPlaneIp}
41 {%- for network in networks %}
42             {{network.name_lower}}: {get_param: {{network.name}}Ip}
43 {%- endfor %}
44             ctlplane_subnet:
45               list_join:
46                 - ''
47                 - - {get_param: ControlPlaneIp}
48                   - '/'
49                   - {get_param: ControlPlaneSubnetCidr}
50 {%- for network in networks %}
51             {{network.name_lower}}_subnet: {get_param: {{network.name}}IpSubnet}
52 {%- endfor %}
53             ctlplane_uri: {get_param: ControlPlaneIp}
54 {%- for network in networks %}
55             {{network.name_lower}}_uri: {get_param: {{network.name}}IpUri}
56 {%- endfor %}
57           - keys:
58 {%- for network in networks %}
59               {{network.name_lower}}: {get_param: {{network.name}}NetName}
60 {%- endfor %}
61 {%- for network in networks %}
62               {{network.name_lower}}_subnet:
63                 str_replace:
64                   template: NAME_subnet
65                   params:
66                     NAME: {get_param: {{network.name}}NetName}
67 {%- endfor %}
68 {%- for network in networks %}
69               {{network.name_lower}}_uri:
70                 str_replace:
71                   template: NAME_uri
72                   params:
73                     NAME: {get_param: {{network.name}}NetName}
74 {%- endfor %}
75
76 outputs:
77   net_ip_map:
78     description: >
79       A Hash containing a mapping of network names to assigned IPs
80       for a specific machine.
81     value: {get_attr: [NetIpMapValue, value]}