Skip to content

Instantly share code, notes, and snippets.

/-

Created October 6, 2016 11:28
Show Gist options
  • Save anonymous/f5ec5e38d555f3d2dc7551bede804772 to your computer and use it in GitHub Desktop.
Save anonymous/f5ec5e38d555f3d2dc7551bede804772 to your computer and use it in GitHub Desktop.
heat_template_version: 2016-04-08
description: Generic Node
parameter_groups:
parameters:
key:
type: string
constraints:
- custom_constraint: nova.keypair
image:
type: string
constraints:
- custom_constraint: glance.image
flavor:
type: string
constraints:
- custom_constraint: nova.flavor
public_network:
type: string
constraints:
- custom_constraint: neutron.network
resources:
###### SETUP ######
network1:
type: OS::Neutron::Net
properties:
name: test-network1
subnet1:
type: OS::Neutron::Subnet
properties:
name: test-subnet1
network_id: { get_resource: network1 }
cidr: 192.168.0.0/24
network2:
type: OS::Neutron::Net
properties:
name: test-network2
subnet2:
type: OS::Neutron::Subnet
properties:
name: test-subnet2
network_id: { get_resource: network2 }
cidr: 192.168.1.0/24
router:
type: OS::Neutron::Router
properties:
name: router
external_gateway_info:
network: { get_param: public_network }
router_interface1:
type: OS::Neutron::RouterInterface
properties:
router: { get_resource: router }
subnet: { get_resource: subnet1 }
router_interface2:
type: OS::Neutron::RouterInterface
properties:
router: { get_resource: router }
subnet: { get_resource: subnet2 }
security_group:
type: OS::Neutron::SecurityGroup
properties:
name: test-security-group
rules:
- remote_ip_prefix: 0.0.0.0/0
script1:
type: OS::Heat::SoftwareConfig
properties:
group: ungrouped
config: |
#!/bin/bash
echo "Configuration 1"
script2:
type: OS::Heat::SoftwareConfig
properties:
group: ungrouped
config: |
#!/bin/bash
echo "Configuration 2"
config:
type: OS::Heat::MultipartMime
properties:
parts:
- config: { get_resource: script1 }
- config: { get_resource: script2 }
###### TESTS ######
node-basic:
type: ../common/generic_node.yaml
properties:
name: node-basic
key: { get_param: key }
image: { get_param: image }
flavor: { get_param: flavor }
networks:
- { get_resource: network1 }
security_groups:
- default
- { get_resource: security_group }
config: { get_resource: config }
depends_on:
- network1
- subnet1
- security_group
node-multi-homed:
type: ../common/generic_node.yaml
properties:
name: node-multi-homed
key: { get_param: key }
image: { get_param: image }
flavor: { get_param: flavor }
networks:
- { get_resource: network1 }
- { get_resource: network2 }
security_groups:
- default
- { get_resource: security_group }
config: { get_resource: config }
depends_on:
- network1
- network2
- subnet1
- subnet2
- security_group
node-no-config:
type: ../common/generic_node.yaml
properties:
name: node-no-config
key: { get_param: key }
image: { get_param: image }
flavor: { get_param: flavor }
networks:
- { get_resource: network1 }
security_groups:
- default
- { get_resource: security_group }
config: None
depends_on:
- network1
- subnet1
- security_group
outputs:
node-basic:
value: { get_attr: [node-basic, node] }
node-basic-name:
value: { get_attr: [node-basic, node, name] }
node-multi-homed:
value: { get_attr: [node-multi-homed, node] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment