Skip to content

Instantly share code, notes, and snippets.

@nati
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save nati/9843661 to your computer and use it in GitHub Desktop.

Select an option

Save nati/9843661 to your computer and use it in GitHub Desktop.
heat_template_version: 2013-05-23
description: >
HOT template to create a new neutron network plus a router to the public
network, and for deploying two servers into the new network. The template also
assigns floating IP addresses to each server so they are routable from the
public network.
preview: https://cdn3.iconfinder.com/data/icons/tango-icon-library/48/network-server-64.png
parameters:
key_name:
type: string
default: default
description: Name of keypair to assign to servers
image:
type: string
default: a097045d-c501-4bba-b8ba-70efa7a97599
description: Name of image to use for servers
flavor:
type: string
default: m1.medium
description: Flavor to use for servers
public_net_id:
type: string
default: 485e0fa1-ff11-4c0a-8c29-182e6af25a6e
description: >
ID of public network for which floating IP addresses will be allocated
private_net_name:
type: string
default: private
description: Name of private network to be created
private_net_cidr:
type: string
default: 10.0.0.0/24
description: Private network address (CIDR notation)
private_net_gateway:
type: string
default: 10.0.0.1
description: Private network gateway address
resources:
private_net:
type: OS::Neutron::Net
properties:
name: { get_param: private_net_name }
private_subnet:
type: OS::Neutron::Subnet
properties:
network_id: { get_resource: private_net }
cidr: { get_param: private_net_cidr }
gateway_ip: { get_param: private_net_gateway }
router:
type: OS::Neutron::Router
router_gateway:
type: OS::Neutron::RouterGateway
properties:
router_id: { get_resource: router }
network_id: { get_param: public_net_id }
router_interface:
type: OS::Neutron::RouterInterface
properties:
router_id: { get_resource: router }
subnet_id: { get_resource: private_subnet }
server1:
type: OS::Nova::Server
properties:
name: Server1
image: { get_param: image }
flavor: { get_param: flavor }
key_name: { get_param: key_name }
availability_zone: nova
networks:
- port: { get_resource: server1_port }
server1_port:
type: OS::Neutron::Port
properties:
network_id: { get_resource: private_net }
fixed_ips:
- subnet_id: { get_resource: private_subnet }
server1_floating_ip:
type: OS::Neutron::FloatingIP
properties:
floating_network_id: { get_param: public_net_id }
port_id: { get_resource: server1_port }
outputs:
server1_private_ip:
description: IP address of server1 in private network
value: { get_attr: [ server1, first_address ] }
server1_public_ip:
description: Floating IP address of server1 in public network
value: { get_attr: [ server1_floating_ip, floating_ip_address ] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment