Refactor Heat template to use generic user
[apex-tripleo-heat-templates.git] / heat.yaml
1 HeatTemplateFormatVersion: '2012-12-12'
2 Description: 'HEAT Template - Heat Engine and API'
3 Parameters:
4   KeyName: 
5     Description: Name of an existing EC2 KeyPair to enable SSH access to the instances
6     Type: String
7     Default: default
8   InstanceType:
9     Description: Use this flavor
10     Type: String
11     Default: bm.small
12   HeatUser:
13     Description: Heat database username.
14     Type: String
15     Default: heat
16   HeatEngineImage:
17     Type: String
18   HeatApiImage:
19     Type: String
20   RabbitMQHost:
21     Description: Host for RabbitMQ
22     Type: String
23   RabbitMQPassword:
24     Description: Password for RabbitMQ
25     Type: String
26   ApiGroupSize:
27     Description: How many API nodes to run
28     Type: Integer
29     Default: 1
30   AvailabilityZones:
31     Type: List
32     Default: [ 1 ]
33   TemplateURL:
34     Type: String
35     Default: https://raw.github.com/openstack-ops/templates/master/
36 Resources:
37   EngineUser:
38     Type: AWS::CloudFormation::Stack
39     TemplateURL: {Fn::Join: [ {Ref: TemplateURL} , 'generic-user.yaml' ]}
40     Parameters:
41       AccessList: [ HeatEngine ]
42   ApiUser:
43     Type: AWS::CloudFormation::Stack
44     TemplateURL: {Fn::Join: [ {Ref: TemplateURL} , 'generic-user.yaml' ]}
45     Parameters:
46       AccessList: [ HeatAPI, HeatAPILaunch ]
47   HeatAPILaunch:
48     Type: AWS::AutoScaling::LaunchConfiguration
49     Metadata:
50       OpenStack::ImageBuilder::Elements: [ heat-api ]
51       heat:
52         rpc_backend: heat.openstack.common.rpc.impl_kombu
53         rabbit:
54           host: {Ref: RabbitMQHost}
55           password: {Ref: RabbitMQPassword}
56         access_key_id:
57           Fn::GetAtt: [ ApiUser, AccessKeyId ]
58         secret_key:
59           Fn::GetAtt: [ ApiUser, SecretAccessKey ]
60         stack:
61           name: {Ref: 'AWS::StackName'}
62           region: {Ref: 'AWS::Region'}
63         refresh:
64           - resource: HeatAPILaunch
65     Properties:
66       ImageId:
67         {Ref: HeatApiImage}
68       InstanceType: {Ref: InstanceType}
69       KeyName: {Ref: KeyName}
70       UserData: "#!/bin/bash\ntouch /tmp/userdata-finished\necho Userdata finished $(date)\n"
71   HeatAPI:
72     Type: OS::Heat::InstanceGroup
73     Properties:
74       LaunchConfiguration: {Ref: HeatApiLaunch}
75       Size: {Ref: ApiGroupSize}
76       AvailabilityZones: {Ref: AvailabilityZones}
77   HeatEngine:
78     Type: AWS::EC2::Instance
79     Properties:
80       ImageId:
81         {Ref: HeatEngineImage}
82     Metadata:
83       heat:
84         rpc_backend: heat.openstack.common.rpc.impl_kombu
85         rabbit:
86           host: {Ref: RabbitMQHost}
87           password: {Ref: RabbitMQPassword}
88         access_key_id:
89           Fn::GetAtt: [ EngineUser, AccessKeyId ]
90         secret_key:
91           Fn::GetAtt: [ EngineUser, SecretAccessKey ]
92         stack:
93           name: {Ref: 'AWS::StackName'}
94           region: {Ref: 'AWS::Region'}
95         refresh:
96           - resource: HeatEngine