Skip to content

Instantly share code, notes, and snippets.

@zioproto
Created August 6, 2018 08:28
Show Gist options
  • Save zioproto/c24177fddfd68030b1fd90ad74144936 to your computer and use it in GitHub Desktop.
Save zioproto/c24177fddfd68030b1fd90ad74144936 to your computer and use it in GitHub Desktop.
Openstack Heat Server with Floating IP
heat_template_version: 2013-05-23
description: HOT to deploy a single instance, within its network, with a floating IP
parameters:
vm_key:
type: string
label: "SSH key name (must exist)"
default: macsp
vm_flavor:
type: string
label: "VM flavor"
default: c1.medium
vm_image:
type: string
label: "OS Image (name or ID)"
default: "Ubuntu Bionic 18.04 (SWITCHengines)"
external_network:
type: string
label: "name of the network to connect routers to"
default: public
resources:
heat_volume:
type: OS::Cinder::Volume
properties:
size: 5
heat_network:
type: OS::Neutron::Net
properties:
name: heat-network
heat_subnet:
type: OS::Neutron::Subnet
properties:
name: heat-subnet
cidr: 192.168.192.0/24
dns_nameservers: [8.8.8.8]
enable_dhcp: true
network: { get_resource: heat_network }
heat_router:
type: OS::Neutron::Router
properties:
admin_state_up: true
name: heat-router
external_gateway_info: {"network": { get_param: external_network }}
heat_router_intf:
type: OS::Neutron::RouterInterface
properties:
router_id: { get_resource: heat_router }
subnet_id: { get_resource: heat_subnet }
heat_security_group:
type: "OS::Neutron::SecurityGroup"
properties:
rules:
- remote_mode: remote_group_id
protocol: tcp
- remote_mode: remote_group_id
protocol: udp
- protocol: icmp
- port_range_min: 22
port_range_max: 22
protocol: tcp
instance0_port:
type: OS::Neutron::Port
properties:
admin_state_up: true
network: { get_resource: heat_network }
fixed_ips:
- subnet: { get_resource: heat_subnet }
security_groups:
- get_resource: heat_security_group
instance0_floatingip:
type: OS::Neutron::FloatingIP
properties:
floating_network: { get_param: external_network }
port_id: { get_resource: instance0_port }
instance0:
type: OS::Nova::Server
properties:
name: heat-vt-u0
key_name: { get_param: vm_key }
image: { get_param: vm_image }
flavor: { get_param: vm_flavor }
networks:
- port: { get_resource: instance0_port }
# see http://blog.scottlowe.org/2015/04/23/ubuntu-openstack-heat-cloud-init/
user_data_format: RAW
outputs:
instance0_ip:
description: Private IP of the instance
value: { get_attr: [instance0, first_address] }
instance0_floatingip:
description: Floating IP of the instance
value: { get_attr: [instance0_floatingip, floating_ip_address] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment