forked from congto/OpenStack-Lab-Tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuserdata-heat-stack.yaml
91 lines (83 loc) · 2.38 KB
/
userdata-heat-stack.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
heat_template_version: 2015-10-15
description: Template to deploy two compute instance with a volume attached
parameters:
image:
type: string
label: Image name or ID
description: Image to be used for compute instance
constraints:
- allowed_values: [cirros, centos, ubuntu]
default: cirros
flavor:
type: string
label: Flavor
description: Type of flavor to be used
constraints:
- allowed_values: [small, medium, large]
default: small
key:
type: string
label: Key name
description: Name of key-pair to be used for compute instance
default: demokey
private_network:
type: string
label: Private network name or ID
description: Network to attach instance to.
volume_size:
type: string
label: size of volume
description: This is the size of the Volume
default: 3
resources:
my_web:
type: OS::Nova::Server
properties:
image: { get_param: image }
flavor: { get_param: flavor }
key_name: { get_param: key }
networks:
- network: { get_param: private_network }
my_db:
type: OS::Nova::Server
properties:
image: { get_param: image }
flavor: { get_param: flavor }
key_name: { get_param: key }
networks:
- network: { get_param: private_network }
user_data_format: RAW
user_data: |
#!/bin/bash
mkfs.ext4 /dev/vdb
echo '/dev/vdb /mnt ext4 defaults 1 1' >> /etc/fstab
mount -a
my_vol:
type: OS::Cinder::Volume
properties:
size: { get_param: volume_size }
vol_attachment:
type: OS::Cinder::VolumeAttachment
properties:
instance_uuid: { get_resource: my_db }
volume_id: { get_resource: my_vol }
mountpoint: /dev/vdb
outputs:
web_instance_name:
description: Name of the web instance
value: { get_attr: [my_web, name] }
web_instance_ip:
description: IP address of the web instance
value: { get_attr: [my_web, first_address] }
db_instance_name:
description: Name of the db instance
value: { get_attr: [my_db, name] }
db_instance_ip:
description: IP address of the db instance
value: { get_attr: [my_db, first_address] }
volume_name:
description: Volume name attached to the db instance
value: { get_attr: [my_vol, display_name] }
volume_type:
description: Volume type attached to the db instance
value: { get_attr: [my_vol, volume_type] }