blob: 499430172c34b854017c9d6b5da328ea4007bbb2 [file] [log] [blame]
---
# ============LICENSE_START=======================================================
# Copyright (C) 2019 The Nordix Foundation. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
# ============LICENSE_END=========================================================
heat_template_version: pike
description: Common template for jumphost instance
parameters:
# parameters for instances
instance_name:
type: string
label: Name
description: Instance name
image:
type: string
label: Image name or ID
description: Image to use for instances
volume_size:
type: string
label: Volume size
description: Size of the volume
flavor:
type: string
label: Flavor
description: Flavor to use for instances
keypair:
type: string
label: Key name
description: Keypair to use for instances
internal_security_group:
type: string
label: Internal Security Group
description: Security Group to place jumphost and cluster instances in
external_security_group:
type: string
label: External Security Group
description: Security Group to place jumphost in
private_network:
type: string
label: Private network name or ID
description: Network to attach instances to
public_network:
type: string
label: Public Network
description: Public network
conditions:
skip_volume: {equals: [{get_param: volume_size}, "0"]}
create_volume:
not: skip_volume
resources:
root_login:
type: OS::Heat::CloudConfig
properties:
cloud_config:
disable_root: false
boot_config:
type: OS::Heat::MultipartMime
properties:
parts:
- config: {get_resource: root_login}
port:
type: OS::Neutron::Port
properties:
network: {get_param: private_network}
replacement_policy: AUTO
security_groups:
- {get_param: internal_security_group}
- {get_param: external_security_group}
floating_ip:
type: OS::Neutron::FloatingIP
properties:
floating_network: {get_param: public_network}
floating_ip_assoc:
type: OS::Neutron::FloatingIPAssociation
properties:
floatingip_id: {get_resource: floating_ip}
port_id: {get_resource: port}
bootable_volume:
type: OS::Cinder::Volume
condition: create_volume
properties:
name:
list_join: ['.', ['volume', {get_param: instance_name}]]
size: {get_param: volume_size}
image: {get_param: image}
instance_with_volume:
type: OS::Nova::Server
condition: create_volume
properties:
name: {get_param: instance_name}
image: {get_param: image}
flavor: {get_param: flavor}
key_name: {get_param: keypair}
networks:
- port: {get_resource: port}
block_device_mapping:
- device_name: vda
volume_id: {get_resource: bootable_volume}
delete_on_termination: true
user_data_format: SOFTWARE_CONFIG
user_data: {get_resource: boot_config}
instance_without_volume:
type: OS::Nova::Server
condition: skip_volume
properties:
name: {get_param: instance_name}
image: {get_param: image}
flavor: {get_param: flavor}
key_name: {get_param: keypair}
networks:
- port: {get_resource: port}
user_data_format: SOFTWARE_CONFIG
user_data: {get_resource: boot_config}
outputs:
instance_public_ip:
value: {get_attr: [floating_ip, floating_ip_address]}
instance_private_ip:
value: {get_attr: [instance_with_volume, first_address]}
# vim: set ts=2 sw=2 expandtab: