summaryrefslogtreecommitdiffstats
path: root/roles/openshift_openstack/templates/heat_stack_server.yaml.j2
blob: a829da34f6ea66940ca61123e499f367df6bd20a (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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
heat_template_version: 2016-10-14

description: OpenShift cluster server

parameters:

  name:
    type: string
    label: Name
    description: Name

  group:
    type: string
    label: Host Group
    description: The Primary Ansible Host Group
    default: host

  cluster_env:
    type: string
    label: Cluster environment
    description: Environment of the cluster

  cluster_id:
    type: string
    label: Cluster ID
    description: Identifier of the cluster

  type:
    type: string
    label: Type
    description: Type master or node

  subtype:
    type: string
    label: Sub-type
    description: Sub-type compute or infra for nodes, default otherwise
    default: default

  key_name:
    type: string
    label: Key name
    description: Key name of keypair

  image:
    type: string
    label: Image
    description: Name of the image

  flavor:
    type: string
    label: Flavor
    description: Name of the flavor

  net:
    type: string
    label: Net ID
    description: Net resource

  net_name:
    type: string
    label: Net name
    description: Net name

{% if not openshift_openstack_provider_network_name %}
  subnet:
    type: string
    label: Subnet ID
    description: Subnet resource
{% endif %}

{% if openshift_use_flannel|default(False)|bool %}
  attach_data_net:
    type: boolean
    default: false
    label: Attach-data-net
    description: A switch for data port connection

  data_net:
    type: string
    default: ''
    label: Net ID
    description: Net resource

{% if not openshift_openstack_provider_network_name %}
  data_subnet:
    type: string
    default: ''
    label: Subnet ID
    description: Subnet resource
{% endif %}
{% endif %}

  secgrp:
    type: comma_delimited_list
    label: Security groups
    description: Security group resources

  attach_float_net:
    type: boolean
    default: true

    label: Attach-float-net
    description: A switch for floating network port connection

{% if not openshift_openstack_provider_network_name %}
  floating_network:
    type: string
    default: ''
    label: Floating network
    description: Network to allocate floating IP from
{% endif %}

  availability_zone:
    type: string
    description: The Availability Zone to launch the instance.
    default: nova

  volume_size:
    type: number
    description: Size of the volume to be created.
    default: 1
    constraints:
      - range: { min: 1, max: 1024 }
        description: must be between 1 and 1024 Gb.

  node_labels:
    type: json
    description: OpenShift Node Labels
    default: {"region": "default" }

  scheduler_hints:
    type: json
    description: Server scheduler hints.
    default: {}

outputs:

  name:
    description: Name of the server
    value: { get_attr: [ server, name ] }

  private_ip:
    description: Private IP of the server
    value:
      get_attr:
        - server
        - addresses
        - { get_param: net_name }
        - 0
        - addr

  floating_ip:
    description: Floating IP of the server
    value:
      get_attr:
        - server
        - addresses
        - { get_param: net_name }
{% if openshift_openstack_provider_network_name %}
        - 0
{% else %}
        - 1
{% endif %}
        - addr

conditions:
  no_floating: {not: { get_param: attach_float_net} }
{% if openshift_use_flannel|default(False)|bool %}
  no_data_subnet: {not: { get_param: attach_data_net} }
{% endif %}

resources:

  server:
    type: OS::Nova::Server
    properties:
      name:      { get_param: name }
      key_name:  { get_param: key_name }
      image:     { get_param: image }
      flavor:    { get_param: flavor }
      networks:
{% if openshift_use_flannel|default(False)|bool %}
        if:
          - no_data_subnet
{% if use_trunk_ports|default(false)|bool %}
          - - port:  { get_attr: [trunk-port, port_id] }
{% else %}
          - - port:  { get_resource: port }
{% endif %}
{% if use_trunk_ports|default(false)|bool %}
          - - port:  { get_attr: [trunk-port, port_id] }
{% else %}
          - - port:  { get_resource: port }
            - port:  { get_resource: data_port }
{% endif %}

{% else %}
{% if use_trunk_ports|default(false)|bool %}
        - port:  { get_attr: [trunk-port, port_id] }
{% else %}
        - port:  { get_resource: port }
{% endif %}
{% endif %}
      user_data:
        get_file: user-data
      user_data_format: RAW
      user_data_update_policy: IGNORE
      metadata:
        group: { get_param: group }
        environment: { get_param: cluster_env }
        clusterid: { get_param: cluster_id }
        host-type: { get_param: type }
        sub-host-type:    { get_param: subtype }
        node_labels: { get_param: node_labels }
      scheduler_hints: { get_param: scheduler_hints }

{% if use_trunk_ports|default(false)|bool %}
  trunk-port:
    type: OS::Neutron::Trunk
    properties:
      name: { get_param: name }
      port: { get_resource: port }
{% endif %}

  port:
    type: OS::Neutron::Port
    properties:
      network: { get_param: net }
{% if not openshift_openstack_provider_network_name %}
      fixed_ips:
        - subnet: { get_param: subnet }
{% endif %}
      security_groups: { get_param: secgrp }

{% if openshift_use_flannel|default(False)|bool %}
  data_port:
    type: OS::Neutron::Port
    condition: { not: no_data_subnet }
    properties:
      network: { get_param: data_net }
      port_security_enabled: false
{% if not openshift_openstack_provider_network_name %}
      fixed_ips:
        - subnet: { get_param: data_subnet }
{% endif %}
{% endif %}

{% if not openshift_openstack_provider_network_name %}
  floating-ip:
    condition: { not: no_floating }
    type: OS::Neutron::FloatingIP
    properties:
      floating_network: { get_param: floating_network }
      port_id: { get_resource: port }
{% endif %}

{% if not openshift_openstack_ephemeral_volumes|default(false)|bool %}
  cinder_volume:
    type: OS::Cinder::Volume
    properties:
      size: { get_param: volume_size }
      availability_zone: { get_param: availability_zone }

  volume_attachment:
    type: OS::Cinder::VolumeAttachment
    properties:
      volume_id: { get_resource: cinder_volume }
      instance_uuid: { get_resource: server }
      mountpoint: /dev/sdb
{% endif %}