aboutsummaryrefslogtreecommitdiffstats
path: root/resources/ansible_roles/qtip-generator/files/compute/heat_template.yml
blob: cb67e6242ac83ab0badfacdc52f4a4196b869ef5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
##############################################################################
# Copyright (c) 2018 ZTE Corporation and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
heat_template_version: 2015-04-30

description: >
  Used to run VMs for QTIP

parameters:
  image:
    type: string
    description: Name of the image
    default: qtip_image

  flavor:
    type: string
    description: Name of flavor
    default: qtip_flavor

  keypair:
    type: string
    description: Name of keypair
    default: QtipKey

  external_network:
    type: string
    description: Name of the external network

resources:

  network:
    type: OS::Neutron::Net
    properties:
      name: qtip_net

  subnet:
    type: OS::Neutron::Subnet
    properties:
      name: qtip_subnet
      ip_version: 4
      cidr: 192.168.0.0/24
      network: { get_resource: network }
      dns_nameservers: [8.8.8.8]

  management_router:
    type: OS::Neutron::Router
    properties:
      name: qtip_router
      external_gateway_info:
        network: { get_param: external_network }

  management_router_interface:
    type: OS::Neutron::RouterInterface
    properties:
      router: { get_resource: management_router }
      subnet: { get_resource: subnet }

  floating_ip:
    type: OS::Neutron::FloatingIP
    properties:
      floating_network: { get_param: external_network }

  floating_ip_association:
    type: OS::Nova::FloatingIPAssociation
    properties:
      floating_ip: { get_resource: floating_ip }
      server_id: { get_resource: qtip_instance }

  security_group:
    type: OS::Neutron::SecurityGroup
    properties:
      name: qtip_security_group
      rules:
          - port_range_min: 22
            port_range_max: 5201
            protocol: tcp
          - port_range_min: 22
            port_range_max: 5201
            protocol: udp
          - protocol: icmp

  qtip_instance:
    type: OS::Nova::Server
    depends_on: [subnet]
    properties:
      name: { get_param: "OS::stack_name" }
      image: { get_param: image }
      flavor: { get_param: flavor }
      key_name: { get_param: keypair }
      security_groups: [{ get_resource: security_group }]
      networks:
        - network: { get_resource: network }
outputs:
  instance_ip:
    description: The IP address of the instance
    value: { get_attr: [floating_ip, floating_ip_address] }