forked from pon-prisma/heat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo_vm_with_volume.template
100 lines (94 loc) · 2.82 KB
/
demo_vm_with_volume.template
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
heat_template_version: 2013-05-23
description: Simple template to deploy a single compute instance with a volume attached
parameters:
key_name:
type: string
description: Name of a KeyPair
vm_name:
type: string
label: VM name
default: stack-vm
image_id:
type: string
label: Image ID
description: Image to be used for compute instance
instance_type:
type: string
label: Instance Type
description: Type of instance (flavor) to be used
default: small
availability_zone:
type: string
description: The Availability Zone to launch the instance.
default: nova
volume_size:
type: number
description: Size of the volume to be created.
default: 1
net_id:
type: string
description: ID of public sub network into which servers get deployed
mountpoint:
type: string
description: The directory to provide to the user
default: /mnt/workingdir
resources:
my_instance:
type: OS::Nova::Server
properties:
name: { get_param: vm_name }
key_name: { get_param: key_name }
image: { get_param: image_id }
availability_zone: { get_param: availability_zone }
flavor: { get_param: instance_type }
networks:
- network: { get_param: net_id }
security_groups: [ { get_resource: server_security_group } ]
user_data_format: RAW
user_data:
str_replace:
template: |
#!/bin/bash -v
#Allow user to use volume
mkdir -p mountpoint
mkfs.ext4 device_name
mount device_name mountpoint
params:
mountpoint: { get_param: mountpoint }
device_name: /dev/vdb
cinder_volume:
type: OS::Cinder::Volume
properties:
size: { get_param: volume_size }
availability_zone: { get_param: availability_zone }
volume_attachment:
type: OS::Cinder::VolumeAttachment
properties:
volume_id: { get_resource: cinder_volume }
instance_uuid: { get_resource: my_instance }
mountpoint: /dev/vdb
server_security_group:
type: OS::Neutron::SecurityGroup
properties:
description: Add security group rules for server
name: security-group
rules:
- 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
outputs:
vmIp:
description: The IP address of the deployed instance
value: { get_attr: [my_instance, first_address] }
vmUuid:
description: Resource ID assigned to the newly created instance
value: { get_resource: my_instance }
vmName:
description: vm name
value: { get_param: vm_name }
volumeUuid:
description: Resource ID assigned to the newly created volume attached to instance
value: { get_resource: cinder_volume }