update comment in the template
[heat-templates.git] / qa / kitchen_sink.template
blob3f260a75967df1ef7e87705942983c757726fd5c
1 heat_template_version: 2013-05-23
3 description: |
4   Test template using all resources supported on the Rackspace Public Cloud
6 parameters:
8   db_pass:
9     type: string
10     hidden: true
11     description: Database access password
12     default: secrete
14   devops_flavor:
15     type: string
16     description: Flavor name for the devops server
17     default: 4 GB Performance
18     constraints:
19     - allowed_values:
20       - 4 GB Performance
21       - 4GB Standard Instance
23   api_flavor_ref:
24     type: string
25     description: API Servers flavor id
26     default: performance1-1
27     constraints:
28     - allowed_values:
29       - performance1-1
30       - "3" # 1GB Standard Instance
32 resources:
34   random_key_name:
35     type: OS::Heat::RandomString
36     properties:
37       length: 8
39   access_key:
40     type: OS::Nova::KeyPair
41     properties:
42       name: { get_resource: random_key_name }
43       save_private_key: true
45   domain_name:
46     type: OS::Heat::RandomString
48   priv_network:
49     type: Rackspace::Cloud::Network
50     properties:
51       label: kitchen_sink
52       cidr: 192.168.0.0/24
53   
54   boot_from_vol_vol:
55     type: OS::Cinder::Volume
56     properties:
57       name: ks-BFV-vol
58       size: 100
59       volume_type: SSD
60       image: CentOS 7 (PVHVM)
61   
62   boot_from_vol_server:
63     type: OS::Nova::Server
64     properties:
65       name: ksink-BFV-server
66       flavor: 2 GB Performance
67       block_device_mapping: [{volume_id: {get_resource: boot_from_vol_vol}, device_name: vda, delete_on_termination: false}]
68   
69 #  neutron_network:
70 #    type: OS::Neutron::Net
71 #    properties:
72 #      name: ksink-neutron-net
73   
74 #  neutron_subnet:
75 #    type: OS::Neutron::Subnet
76 #    properties:
77 #      name: ksink-subnet-1
78 #      network: { get_resource: neutron_network }
79 #      cidr: 192.168.0.0/24
80 #      ip_version: 4
81   
82 #  neutron_port:
83 #    type: OS::Neutron::Port
84 #    properties:
85 #      name: ksink-port-1
86 #      network: { get_resource: neutron_network }
88   gentoo_server:  # Should create as long as there's no user_data
89     type: Rackspace::Cloud::Server
90     properties:
91       flavor: 1 GB Performance
92       image: 26c630fe-ba65-4cd2-ad69-1d808766a54b  # Gentoo 14.4
94   devops_server:
95     type: OS::Nova::Server
96     properties:
97       name: kitchen_sink_ops01
98       metadata:
99         rax-heat: { get_param: "OS::stack_id" }
100       image: 042395fc-728c-4763-86f9-9b0cacb00701 #CentOS 6.5
101       flavor: { get_param: devops_flavor }
102       key_name: { get_resource: access_key }
103       networks:
104       - uuid: "00000000-0000-0000-0000-000000000000"
105       - uuid: "11111111-1111-1111-1111-111111111111"
106       - uuid: { get_resource: priv_network }
108 ################################################################
109 #### THIS IS BROKEN ATM: https://jira.rax.io/browse/HEAT-789 ###
110 ################################################################
111 #  devops_chefsolo_berkshelf:
112 #     type: "OS::Heat::ChefSolo"
113 #     depends_on: devops_chefsolo_kitchen_centos
114 #     properties:
115 #         private_key: {get_attr: [access_key, private_key]}
116 #         host: {get_attr: [devops_server, accessIPv4]}
117 #         chef_version: "11.12.0"
118 #         Berksfile: |
119 #            site :opscode
120 #            cookbook 'apt'
122 #         Berksfile.lock: |
123 #            {
124 #              "sources": {
125 #                "apt": {
126 #                  "locked_version": "2.3.8"
127 #                }
128 #              }
129 #            }
131 #         node:
132 #            hello: "hi"
134   devops_chefsolo_kitchen_centos:
135     type: "OS::Heat::ChefSolo"
136     properties:
137        private_key: {get_attr: [access_key, private_key]}
138        host: {get_attr: [devops_server, accessIPv4]}
139        kitchen: "https://github.com/heat-ci/heat-templates.git"
140        node:
141          hello: "hi"
143   devops_volume:
144     type: OS::Cinder::Volume
145     properties:
146       name: kitchen_sink_devops_vol
147       metadata:
148         rax-heat: { get_param: "OS::stack_id" }
149       size: 100
150       description: Created from the kitchen_sink test Heat template
152   attach_devops_vol:
153     type: OS::Cinder::VolumeAttachment
154     properties:
155       instance_uuid: { get_resource: devops_server }
156       volume_id: { get_resource: devops_volume }
158   api_servers:
159     type: Rackspace::AutoScale::Group
160     properties:
161       groupConfiguration:
162         name: kitchen_sink_api_asgroup
163         metadata:
164           rax-heat: { get_param: "OS::stack_id" }
165         maxEntities: 8
166         minEntities: 2
167         cooldown: 120
168       launchConfiguration:
169         type: launch_server
170         args:
171           loadBalancers:
172           - loadBalancerId: { get_resource: api_loadbalancer }
173             port: 80
174           server:
175             name: kitchen_sink_api
176             flavorRef: { get_param: api_flavor_ref }
177             imageRef: ffd597d6-2cc4-4b43-b8f4-b1006715b84e
178             key_name: { get_resource: access_key }
179             personality:
180                 /tmp/testfile: "testfile"
181             networks:
182             - uuid: "11111111-1111-1111-1111-111111111111"
183             - uuid: { get_resource: priv_network }
185   api_servers_no_personality:
186     type: Rackspace::AutoScale::Group
187     properties:
188       groupConfiguration:
189         name: kitchen_sink_api_asgroup_no_personality
190         metadata:
191           rax-heat: { get_param: "OS::stack_id" }
192         maxEntities: 8
193         minEntities: 2
194         cooldown: 120
195       launchConfiguration:
196         type: launch_server
197         args:
198           loadBalancers:
199           - loadBalancerId: { get_resource: api_loadbalancer }
200             port: 80
201           server:
202             name: kitchen_sink_api
203             flavorRef: { get_param: api_flavor_ref }
204             imageRef: df27d481-63a5-40ca-8920-3d132ed643d9
205             key_name: { get_resource: access_key }
206             networks:
207             - uuid: "11111111-1111-1111-1111-111111111111"
208             - uuid: { get_resource: priv_network }
210   api_scale_up_policy:
211     type: Rackspace::AutoScale::ScalingPolicy
212     properties:
213       group: { get_resource: api_servers }
214       name: Scale up api servers
215       change: 1
216       cooldown: 600
217       type: webhook
219   api_scale_up_webhook:
220     type: Rackspace::AutoScale::WebHook
221     properties:
222       name: triggerApiScaleUp
223       metadata:
224         rax-heat: { get_param: "OS::stack_id" }
225       policy: { get_resource: api_scale_up_policy }
227   api_scale_down_policy:
228     type: Rackspace::AutoScale::ScalingPolicy
229     properties:
230       group: { get_resource: api_servers }
231       name: Scale down api servers
232       change: -1
233       cooldown: 600
234       type: webhook
236   api_scale_down_webhook:
237     type: Rackspace::AutoScale::WebHook
238     properties:
239       name: triggerApiScaleUp
240       metadata:
241         rax-heat: { get_param: "OS::stack_id" }
242       policy: { get_resource: api_scale_down_policy }
244   api_loadbalancer:
245     type: Rackspace::Cloud::LoadBalancer
246     properties:
247       name: kitchen_sink_api_lb
248       metadata:
249         rax-heat: { get_param: "OS::stack_id" }
250       protocol: HTTPS
251       port: 80
252       algorithm: ROUND_ROBIN
253       nodes: []
254       virtualIps:
255       - type: PUBLIC
256         ipVersion: IPV4
258   lb_shared_vip:
259     type: Rackspace::Cloud::LoadBalancer
260     properties:
261       name: ksink_shared_vip_https
262       metadata:
263         rax-heat: { get_param: "OS::stack_id" }
264       protocol: HTTPS
265       port: 443
266       algorithm: ROUND_ROBIN
267       nodes: []
268       virtualIps:
269       - id: { get_attr: [ api_loadbalancer, virtualIps, 0, id ] }
270   
271   wait_on_server:
272     type: OS::Heat::SwiftSignal
273     properties:
274       handle: {get_resource: wait_handle}
275       count: 5
276       timeout: 600
278   wait_handle:
279     type: OS::Heat::SwiftSignalHandle
281   instance1:
282     type: OS::Nova::Server
283     properties:
284       image: 4b14a92e-84c8-4770-9245-91ecb8501cc2  # CentOS
285       flavor: 1 GB Performance
286       key_name: { get_resource: access_key }
287       metadata:
288         rax-heat: { get_param: "OS::stack_id" }
289         heat-stack-name: { get_param: "OS::stack_name" }
290       config_drive: True
291 #      networks:
292 #      - uuid: "11111111-1111-1111-1111-111111111111"
293 #      - uuid: { get_resource: neutron_network } 
294       user_data_format: RAW
295       user_data:
296         str_replace:
297           template: |
298             #!/bin/bash -x
299             # Below are some examples of the various ways signals
300             # can be sent to the Handle resource
302             # Simple success signal
303             wc_notify --data-binary '{"status": "SUCCESS"}'
305             # Or you optionally can specify any of the additional fields
306             wc_notify --data-binary '{"status": "SUCCESS", "reason": "signal2"}'
307             wc_notify --data-binary '{"status": "SUCCESS", "reason": "signal3", "data": "data3"}'
308             wc_notify --data-binary '{"status": "SUCCESS", "reason": "signal4", "data": "data4"}'
310             # If you require control of the ID, you can pass it.
311             # The ID should be unique, unless you intend for duplicate
312             # signals to overrite each other.  The following two calls
313             # do the exact same thing, and will be treated as one signal
314             # (You can prove this by changing count above to 7)
315             wc_notify --data-binary '{"status": "SUCCESS", "id": "5"}'
316             wc_notify --data-binary '{"status": "SUCCESS", "id": "5"}'
318             # Example of sending a failure signal, optionally
319             # reason, id, and data can be specified as above
320             # wc_notify --data-binary '{"status": "FAILURE"}'
322           params:
323             wc_notify: { get_attr: ['wait_handle', 'curl_cli'] }
325   service_domain:
326     type: Rackspace::Cloud::DNS
327     depends_on: wait_on_server
328     properties:
329       name:
330         str_replace:
331           template: "a%domain%.com"
332           params:
333             "%domain%": { get_resource: domain_name }
334       emailAddress:
335         str_replace:
336           template: "admin@{domain}"
337           params:
338             "{domain}":
339               str_replace:
340                 template: "a%domain%.com"
341                 params:
342                   "%domain%": { get_resource: domain_name }
343       records:
344       - name:
345           str_replace:
346             template: "a%domain%.com"
347             params:
348               "%domain%": { get_resource: domain_name }
349         type: A
350         data: { get_attr: [api_loadbalancer, PublicIp] }
352   engine_nodes:
353     type: OS::Heat::ResourceGroup
354     depends_on: service_db
355     properties:
356       count: 2
357       resource_def:
358         type: Rackspace::Cloud::Server
359         properties:
360           name: "kitchen_sink_engine_%index%"
361           image: 753a7703-4960-488b-aab4-a3cdd4b276dc # Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
362           flavor: { get_param: devops_flavor }
363           key_name: { get_resource: access_key }
364           networks:
365           - uuid: { get_resource: priv_network }
366           - uuid: "00000000-0000-0000-0000-000000000000"
367           - uuid: "11111111-1111-1111-1111-111111111111"
368           user_data: |
369             #!/bin/bash -x
370             echo "hello world" > /root/hello-world.txt
372   rs_windows_server:
373     type: "Rackspace::Cloud::WinServer"
374     properties:
375       name: wordpress_windows_server
376       flavor: 4GB Standard Instance
377       image: Windows Server 2012
378       user_data: |
379         $source = "http://download.microsoft.com/download/7/0/4/704CEB4C-9F42-4962-A2B0-5C84B0682C7A/WebPlatformInstaller_amd64_en-US.msi"
380         $destination = "webpi.msi"
381         $wc = New-Object System.Net.WebClient
382         $wc.DownloadFile($source, $destination)
384   service_db:
385     type: OS::Trove::Instance
386     properties:
387       name: kitchen_sink_db
388       flavor: 1GB Instance
389       size: 10
390       databases:
391       - name: kitchen_sink_data
392       users:
393       - name: kitchen_sink
394         password: { get_param: db_pass }
395         databases: [ kitchen_sink_data ]
397   # This needs an image with heat_cfntools on it to use Metadata; basic
398   # test here to make sure we can actually pop the server and do simple
399   # user data and a signal
400   aws_server:
401     type: AWS::EC2::Instance
402     properties:
403       ImageId: 753a7703-4960-488b-aab4-a3cdd4b276dc # Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
404       InstanceType: { get_param: devops_flavor }
405       KeyName: { get_resource: access_key }
406       UserData:
407         str_replace:
408           template: |
409             #!/bin/bash
410             apt-get update
411             apt-get -y install curl
412             sleep 2
413             curl -i -X PUT --data-binary '{"status": "SUCCESS", "reason": "AWS Signal"}' "wc_notify"
414           params:
415             wc_notify: { get_resource: aws_handle }
416   
417   aws_handle:
418     type: AWS::CloudFormation::WaitConditionHandle
419   
420   aws_wait_condition:
421     type: AWS::CloudFormation::WaitCondition
422     properties:
423       Handle: { get_resource: aws_handle }
424       Timeout: 600
426   object_store:
427     type: OS::Swift::Container
428     properties:
429       name: { get_resource: random_key_name }
431   ElasticLoadBalancer:
432         type: AWS::ElasticLoadBalancing::LoadBalancer
433         properties:
434             AvailabilityZones: []
435             Instances:
436             - "192.168.6.100"
437             - "192.168.6.101"
438             Listeners: [{
439                 LoadBalancerPort: 8945,
440                 InstancePort: 80,
441                 Protocol: "HTTP"
442             }]
443             HealthCheck:
444                 Target: "HTTP:80/"
445                 HealthyThreshold: 3
446                 UnhealthyThreshold: 10
447                 Interval: 10
448                 Timeout: 60
450   provider_resource:
451     type: https://raw.githubusercontent.com/heat-ci/heat-templates/master/dev/provider_resource.template
452     properties:
453       flavor: { get_param: devops_flavor }
454       image: 753a7703-4960-488b-aab4-a3cdd4b276dc # Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
455       key_name: { get_resource: access_key }
457 outputs:
459   "Private Network ID":
460     value: { get_resource: priv_network }
461     description: Private Network ID
462   
463   "Neutron Network":
464     value: { get_resource: neutron_network }
465   
466   "Wait Condition data":
467      value: { get_attr: [ wait_on_server, data ] }
469   "Random String":
470     value: { get_attr: [ random_key_name, value ] }
471     description: Random String
473   "Swift Container ID":
474     value: { get_resource: object_store }
475     description: Swift Container ID
477   "Dev Ops Server ID":
478     value: { get_resource: devops_server }
479     description: Dev Ops Server ID
481   "Dev Ops Volume ID":
482     value: { get_resource: devops_volume }
483     description: Dev Ops Volume ID
485   "API servers auto scale group ID":
486     value: { get_resource: api_servers }
487     description: API servers auto scale group ID
489   "API servers auto scale group ID":
490     value: { get_resource: api_servers_no_personality }
491     description: API servers auto scale group ID
493   "Scale UP API servers webhook":
494     value: { get_attr: [ api_scale_up_webhook, executeUrl ] }
495     description: Scale UP API servers webhook
497   "Scale DOWN API servers webhook":
498     value: { get_attr: [ api_scale_down_webhook, executeUrl ] }
499     description: Scale DOWN API servers webhook
501   "Load Balancer ID":
502     value: { get_resource: api_loadbalancer }
503     description: Load Balancer ID
505   "Load Balancer IP":
506     value: { get_attr: [ api_loadbalancer, PublicIp ] }
507     description: Load Balancer IP
509   "DNS Domain ID":
510     value: { get_resource: service_domain }
511     description: DNS Domain ID
513   "Engine Node IDs":
514     value: { get_attr: [ engine_nodes, refs ] }
515     description: Engine Node IDs
517   "DB ID":
518     value: { get_resource: service_db }
519     description: Database instance ID
521   "Access Private Key":
522     value: { get_attr: [ access_key, private_key ] }
523     description: SSH access private key
525   "AWS Server ID":
526     value: { get_resource: aws_server }
527     description: ID of the AWS::EC2::Instance resource
529   "Windows Server IP":
530     value: { get_attr: [ rs_windows_server, accessIPv4 ] }
531     description: Windows Server IP