-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate-2vm-samevn.yaml
145 lines (121 loc) · 4.53 KB
/
create-2vm-samevn.yaml
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
heat_template_version: 2015-04-30
description: Heat template to create a VirtualNetwork and 2VM's in same VN
parameters:
domain:
type: string
description: Domain for the VirtualNetwork
default: default-domain
tenant_name:
type: string
description: tenant/project for the VirtualNetwork
ipam_name:
type: string
description: Name of IPAM to be created
network_name:
type: string
description: Name of VirtualNetwork to be created
network_subnet_prefix:
type: string
description: Prefix of the Virtual Network
network_subnet_prefix_len:
type: string
description: Prefix length of the Virtual Network
network_subnet_default_gw:
type: string
description: Default Gateway of the Virtual Network
network_is_shared:
type: boolean
description: Is the Virtual Network shared or not
route_target:
type: string
description: Route Target of the virtual Network
vm1_name:
type: string
description: VM1 name to be created
vm2_name:
type: string
description: VM2 name to be created
vm_image:
type: string
description: Name of the VM image
vm_flavor:
type: string
description: Flavor of the VM image
resources:
template_NetworkIpam_1:
type: OS::ContrailV2::NetworkIpam
properties:
name: { get_param: ipam_name }
fq_name: { list_join: [':', [ { get_param: domain }, { get_param: tenant_name }, { get_param: ipam_name }]] }
project: { list_join: [':', [ { get_param: domain }, { get_param: tenant_name }]] }
template_VirtualNetwork_1:
type: OS::ContrailV2::VirtualNetwork
depends_on: [ template_NetworkIpam_1 ]
properties:
name: { get_param: network_name }
network_ipam_refs: [{ get_resource: template_NetworkIpam_1 }]
network_ipam_refs_data:
[{
network_ipam_refs_data_ipam_subnets:
[{
network_ipam_refs_data_ipam_subnets_subnet:
{
network_ipam_refs_data_ipam_subnets_subnet_ip_prefix: { get_param: network_subnet_prefix },
network_ipam_refs_data_ipam_subnets_subnet_ip_prefix_len: { get_param: network_subnet_prefix_len },
},
network_ipam_refs_data_ipam_subnets_default_gateway: { get_param: network_subnet_default_gw },
}]
}]
route_target_list:
{
route_target_list_route_target: [{ get_param: route_target }],
}
is_shared: { get_param: network_is_shared }
project: { list_join: [':', [ { get_param: domain }, { get_param: tenant_name }]] }
template_VirtualMachineInterface_1:
type: OS::ContrailV2::VirtualMachineInterface
properties:
name: { get_param: vm1_name }
virtual_network_refs: [{ list_join: [':', { get_attr: [ template_VirtualNetwork_1, fq_name ] } ] }]
template_InstanceIp_1:
type: OS::ContrailV2::InstanceIp
depends_on: [ template_VirtualMachineInterface_1, template_VirtualNetwork_1 ]
properties:
virtual_machine_interface_refs: [{ get_resource: template_VirtualMachineInterface_1 }]
virtual_network_refs: [{ list_join: [':', { get_attr: [ template_VirtualNetwork_1, fq_name ] } ] }]
vm1:
type: OS::Nova::Server
depends_on: [ template_InstanceIp_1 ]
properties:
name: {get_param: vm1_name }
image: { get_param: vm_image }
flavor: { get_param: vm_flavor }
networks:
- port: { get_resource: template_VirtualMachineInterface_1 }
template_VirtualMachineInterface_2:
type: OS::ContrailV2::VirtualMachineInterface
properties:
name: { get_param: vm2_name }
virtual_network_refs: [{ list_join: [':', { get_attr: [ template_VirtualNetwork_1, fq_name ] } ] }]
template_InstanceIp_2:
type: OS::ContrailV2::InstanceIp
depends_on: [ template_VirtualMachineInterface_2, template_VirtualNetwork_1 ]
properties:
virtual_machine_interface_refs: [{ get_resource: template_VirtualMachineInterface_2 }]
virtual_network_refs: [{ list_join: [':', { get_attr: [ template_VirtualNetwork_1, fq_name ] } ] }]
vm2:
type: OS::Nova::Server
depends_on: [ template_InstanceIp_2 ]
properties:
name: {get_param: vm2_name }
image: { get_param: vm_image }
flavor: { get_param: vm_flavor }
networks:
- port: { get_resource: template_VirtualMachineInterface_2 }
outputs:
vm1_ip:
description: VM1 IP
value: { get_attr: [ template_InstanceIp_1, instance_ip_address]}
vm2_ip:
description: VM2 IP
value: { get_attr: [ template_InstanceIp_2, instance_ip_address]}