Skip to content

Instantly share code, notes, and snippets.

@ShawnClake
Last active November 28, 2017 16:57
Show Gist options
  • Save ShawnClake/e324497e1902cd95567af2e81022db86 to your computer and use it in GitHub Desktop.
Save ShawnClake/e324497e1902cd95567af2e81022db86 to your computer and use it in GitHub Desktop.
OpenStack Heat Template - 4i_2n_2v
heat_template_version: 2017-09-01
parameters:
key_name:
type: string
description: Name of a KeyPair
flavor_name:
type: string
description: Name of a Flavor
image_name:
type: string
description: Name of an Image
vnf_volume_name:
type: string
description: Name of a VNF Volume
vnf_image_name:
type: string
description: Name of a VNF Image
tenant1_cidr:
type: string
description: CIDR for Tenant 1
tenant2_cidr:
type: string
description: CIDR for Tenant 2
connect_to_prov:
type: boolean
description: Connect VNF's to provider?
resources:
vnf-volume1:
type: OS::Cinder::Volume
properties:
size: 5
source_volid: { get_param: vnf_volume_name }
vnf-volume2:
type: OS::Cinder::Volume
properties:
size: 5
source_volid: { get_param: vnf_volume_name }
tenant1:
type: https://gist.githubusercontent.com/ShawnClake/85a68a78463e8282b695067f03e472cf/raw/73c6d5a4a0b8f4c5b884442453fc193a19023aed/openstack-heat-template-2i_1n.yaml
properties:
key_name: { get_param: key_name }
flavor_name: { get_param: flavor_name }
image_name: { get_param: image_name }
subnet_cidr: { get_param: tenant1_cidr }
tenant2:
type: https://gist.githubusercontent.com/ShawnClake/85a68a78463e8282b695067f03e472cf/raw/73c6d5a4a0b8f4c5b884442453fc193a19023aed/openstack-heat-template-2i_1n.yaml
properties:
key_name: { get_param: key_name }
flavor_name: { get_param: flavor_name }
image_name: { get_param: image_name }
subnet_cidr: { get_param: tenant2_cidr }
vnf-server1:
type: OS::Nova::Server
properties:
key_name: { get_param: key_name }
flavor: sktel.small
block_device_mapping_v2: [{device_name: "vda", volume_id: {get_resource: vnf-volume1}, delete_on_termination: "false"}]
networks:
- network: provider_network
- network: { get_attr: [tenant1, resource.internal_net] }
security_groups:
- default
- ssh
- vnc
- ping
vnf-server2:
type: OS::Nova::Server
properties:
key_name: { get_param: key_name }
flavor: sktel.small
block_device_mapping_v2: [{device_name: "vda", volume_id: {get_resource: vnf-volume2}, delete_on_termination: "false"}]
networks:
- network: provider_network
- network: { get_attr: [tenant2, resource.internal_net] }
security_groups:
- default
- ssh
- vnc
- ping
outputs:
internal_net:
description: inet1
value: { get_attr: [tenant1, resource.internal_net] }
internal_net2:
description: inet2
value: { get_attr: [tenant2, resource.internal_net] }
outster:
description: inet2
value: { get_attr: [vnf-server1] }
@ShawnClake
Copy link
Author

ShawnClake commented Nov 28, 2017

Here's a quick JSON structure of the template

{
  "template": {
    "provider": {
      "vnf-1": {
        "network-a": {
          "instance-1": {
            "volume-1": {}
          },
          "instance-2": {
            "volume-2": {}
          }
        }
      },
      "vnf-2": {
        "network-b": {
          "instance-3": {
            "volume-3": {}
          },
          "instance-4": {
            "volume-4": {}
          }
        }
      }
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment