Skip to content

Instantly share code, notes, and snippets.

@larsks
Created January 30, 2014 16:34
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save larsks/8712687 to your computer and use it in GitHub Desktop.
heat_template_version: 2013-05-23
description: >
A three-node openstack deployment.
parameters:
image:
type: string
default: cirros
description: ID of the image to use for the instance
flavor:
type: string
default: m1.tiny
key_name:
type: string
default: lars
description: Name of keypair that will be used for access to hosts.
nameserver:
type: string
description: IP address of a nameserver that will used by the api subnet.
default: 192.168.200.1
public_net_id:
type: string
description: UUID of of an "external" network.
default: 9624fa1b-aae7-4670-932a-733653fec250
resources:
########################################################################
##
## NETWORKS
##
router0:
type: OS::Neutron::Router
router0_gw:
type: OS::Neutron::RouterGateway
properties:
router_id: {get_resource: router0}
network_id: {get_param: public_net_id}
router0_if_private:
type: OS::Neutron::RouterInterface
properties:
router_id: {get_resource: router0}
subnet_id: {get_resource: subnet_private}
net_private:
type: OS::Neutron::Net
subnet_private:
type: OS::Neutron::Subnet
properties:
cidr: 10.0.0.0/24
network_id: {get_resource: net_private}
dns_nameservers:
- {get_param: nameserver}
########################################################################
##
## SECURITY GROUPS
##
sg_base:
type: OS::Neutron::SecurityGroup
properties:
rules:
- protocol: icmp
- port_range_min: 22
port_range_max: 22
protocol: tcp
########################################################################
##
## INSTANCES
##
instance0:
type: OS::Nova::Server
properties:
flavor: {get_param: flavor}
image: {get_param: image}
key_name: { get_param: key_name }
networks:
- port: { get_resource: instance0_eth0 }
metadata:
internal_ip: {get_attr: [ instance0_eth0, fixed_ips ] }
internal_ip_simple: {"Fn::Select": ["ip_address", {"Fn::Select": [ 0, { get_attr: [ instance0_eth0, fixed_ips ] }]}]}
instance0_eth0:
type: OS::Neutron::Port
properties:
network_id: { get_resource: net_private }
fixed_ips:
- subnet_id: { get_resource: subnet_private }
security_groups:
- {get_resource: sg_base}
instance0_floating:
type: OS::Neutron::FloatingIP
properties:
floating_network_id: { get_param: public_net_id }
port_id: { get_resource: instance0_eth0 }
outputs:
instance0_external_ip:
value: { get_attr: [ instance0_floating, floating_ip_address ] }
instance0_internal_ip:
value: {get_attr: [instance0, first_address]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment