Skip to content

devstack heat

debashish216 edited this page Mar 11, 2017 · 3 revisions
Orchestration using Heat Template
  • Ensure that heat module is available on devstack controller node.
  • Create a YAML file defining the service details that you want to run on devstack cloud infrastructure.
  • Log in to devstack Horizon dashboard and navigate to Project-> Orchestration-> Stacks.
  • Click on "Launch Stack" option and select the YAML file. Alternatively, you can directly paste the YAML file content to the test area provided in the screen.
  • Click "Next". A parameter page pops up where you can customize the service parameters.
  • Click "Launch" option to deploy your service stack.
  • Upon successful status of "stack creation complete", you can log in to the instance and access.
A Sample YAML file
  • Below is a sample YAML file format which defines and declares all the parameters and resources needed to create a simple instance with one compute node.
heat_template_version: 2016-10-14 ##  This template suits for Newton Version

description: >   ## Multi line Description
  This is a simple template to deploy a single compute instance 
  with customized image, network and other parameters.

## Definition of all the VM instance related parameters
parameters:  
  param-vm-name:
    type: string
    label: Host name of the VM
    description: The hostname of the VM instance
    constraints:
    - length: { min: 3, max: 10 }
      description: Hostname name must be between 3 and 10 characters
    #- allowed_pattern: "[a-z0-9]*"
    #  description: Hostname contains only lowercase characters and numbers
    default: test-vm 

  param-flavor:
    type: string
    label: Nova flavors for compute nodes
    description: Flavor to be loaded onto the VM Instance
    constraints:
    - custom_constraint: nova.flavor
    default: "m1.large"    
    ## m1.tiny (1 vCPU, 512 MB RAM, 1 GB Root Disk)  
    ## m1.small (1 vCPU, 2 GB RAM, 20 GB Root Disk)  
    ## m1.medium (2 vCPU, 4 GB RAM, 40 GB Root Disk)  
    ## m1.large (4 vCPU, 8 GB RAM, 80 GB Root Disk)  

  param-image:
    type: string
    label: Nova images for compute nodes
    description: Image to be loaded onto the VM Instance
    constraints:
    - custom_constraint: glance.image
    default: "cirros-0.3.4-x86_64-uec" ## ubuntu-xenial-amd64, ubuntu-trusty-amd64, cirros-0.3.4-x86_64-uec

  param-key:
    type: string
    label: SSH Keypair
    description: The SSH keypair for accessing VM instances 
    constraints:
    - custom_constraint: nova.keypair
    default: "mykey"  

  net-dns1:
    type: string
    label: Private Network DNS 1 Parameter
    description: Private Network DNS 1 Parameter
    default: "8.8.8.8"

  net-dns2:
    type: string
    label: Private Network DNS 2 Parameter
    description: Private Network DNS 2 Parameter
    default: "8.8.4.4"

  private-net-cidr: 
    type: string
    label: Private Network CIDR Parameter
    description: Private network CIDR string for IPv4 Addressing
    default: 10.10.10.0/24

  extnet:
    type: string
    label: External Network
    description: Name of the external network containing floating IPs
    default: "public"

## Definition of all the resources being requested by tenant
resources:

  vm_secgroup:
    type: OS::Neutron::SecurityGroup
    properties:
      description: Add security group rules for VM instance
      name: { get_param: param-vm-name }
      rules: ## Adding rules for Ingress ICMP and SSH 
        - remote_ip_prefix: 0.0.0.0/0
          protocol: tcp
          port_range_min: 22
          port_range_max: 22
        - remote_ip_prefix: 0.0.0.0/0
          protocol: icmp

  private_net:
    type: OS::Neutron::Net
    properties:
      name: Private_Net

  private_subnet:
    type: OS::Neutron::Subnet
    depends_on: private_net
    properties:
      name: Private-Subnet
      ip_version: 4
      network_id: { get_resource: private_net }
      dns_nameservers:
        - { get_param: net-dns1 }
        - { get_param: net-dns2 }
      cidr: { get_param: private-net-cidr }

  vm_port:
    type: OS::Neutron::Port
    properties:
      network_id: { get_resource: private_net }
      fixed_ips:
        - subnet_id: { get_resource: private_subnet }
      security_groups: [{ get_resource: vm_secgroup }]


  router:
    type: OS::Neutron::Router
    properties:
      name: My-Test-Router

  router_interface:
    type: OS::Neutron::RouterInterface
    depends_on: [ private_subnet, private_net, router ]
    properties:
      subnet: { get_resource: private_subnet }
      router: { get_resource: router }

  router_gateway:
    type: OS::Neutron::RouterGateway
    depends_on: router
    properties:
      network: { get_param: extnet }
      router_id: { get_resource: router }

  floating_ip:
    type: OS::Neutron::FloatingIP
    depends_on: [ private_subnet, vm_port, router_interface ]
    properties:
      floating_network: { get_param: extnet }
      port_id: { get_resource: vm_port }

  instance:
    type: OS::Nova::Server
    depends_on: [ vm_port, router_interface ]
    properties:
      name: { get_param: param-vm-name }
      flavor: { get_param: param-flavor }
      image: { get_param: param-image }
      key_name: { get_param: param-key }
      networks:
        - port: { get_resource: vm_port }

Thank You !

Clone this wiki locally