aboutsummaryrefslogtreecommitdiffstats
path: root/network/ports/net_ip_map.j2.yaml
blob: f01d624af31ba6c4cecbd73c0945f45bb4a7c3c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
heat_template_version: pike

parameters:
  ControlPlaneIp:
    default: ''
    type: string
  ControlPlaneSubnetCidr: # Override this via parameter_defaults
    default: '24'
    description: The subnet CIDR of the control plane network.
    type: string
{%- for network in networks %}
  {{network.name}}Ip:
    default: ''
    type: string
  {{network.name}}IpSubnet:
    description: 'IP address/subnet on the {{network.name_lower}} network'
    default: ''
    type: string
  {{network.name}}IpUri:
    default: ''
    type: string
    description: IP address with brackets in case of IPv6
{%- endfor %}

{%- for network in networks %}
  {{network.name}}NetName:
    default: {{network.name_lower}}
    description: The name of the {{network.name_lower}} network.
    type: string
{%- endfor %}

resources:

  NetIpMapValue:
    type: OS::Heat::Value
    properties:
      type: json
      value:
        map_replace:
          - ctlplane: {get_param: ControlPlaneIp}
{%- for network in networks %}
            {{network.name_lower}}: {get_param: {{network.name}}Ip}
{%- endfor %}
            ctlplane_subnet:
              list_join:
                - ''
                - - {get_param: ControlPlaneIp}
                  - '/'
                  - {get_param: ControlPlaneSubnetCidr}
{%- for network in networks %}
            {{network.name_lower}}_subnet: {get_param: {{network.name}}IpSubnet}
{%- endfor %}
            ctlplane_uri: {get_param: ControlPlaneIp}
{%- for network in networks %}
            {{network.name_lower}}_uri: {get_param: {{network.name}}IpUri}
{%- endfor %}
          - keys:
{%- for network in networks %}
              {{network.name_lower}}: {get_param: {{network.name}}NetName}
{%- endfor %}
{%- for network in networks %}
              {{network.name_lower}}_subnet:
                str_replace:
                  template: NAME_subnet
                  params:
                    NAME: {get_param: {{network.name}}NetName}
{%- endfor %}
{%- for network in networks %}
              {{network.name_lower}}_uri:
                str_replace:
                  template: NAME_uri
                  params:
                    NAME: {get_param: {{network.name}}NetName}
{%- endfor %}

outputs:
  net_ip_map:
    description: >
      A Hash containing a mapping of network names to assigned IPs
      for a specific machine.
    value: {get_attr: [NetIpMapValue, value]}