Adding bootstrap parameters
[apex-tripleo-heat-templates.git] / mysql.yaml
1 HeatTemplateFormatVersion: '2012-12-12'
2 Description: 'HEAT Template - Dedicated MySQL server'
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: m1.small
12   MySQLImage:
13     Type: String
14   KeystoneUser:
15     Description: Keystone database username.
16     Type: String
17     Default: keystone
18   BootstrapUrl:
19     Description: Fetch a mysql dump file from this URL and load it
20     Type: String
21     Default: ''
22   BootstrapUrl:
23     Description: Fetch a mysql config file from this URL to setup local root with bootstrapped database
24     Type: String
25     Default: ''
26 Resources:
27   ApiAccessPolicy:
28     Type: OS::Heat::AccessPolicy
29     Properties:
30       AllowedResources: [ MySQL ]
31   ApiUser:
32     Type: AWS::IAM::User
33     Properties:
34       Policies: [ { Ref: ApiAccessPolicy } ]
35   MySQL:
36     Type: AWS::EC2::Instance
37     Metadata:
38       OpenStack::ImageBuilder::Elements: [ openstack-db ]
39       OpenStack::Config:
40         mysql:
41           users:
42             - database: keystone
43               username: {Ref: KeystoneUser}
44               userhandle: {Ref: KeystonePasswordHandle}
45           bootstrap_url: {Ref: BootstrapUrl}
46           root_cnf_url: {Ref: BootstrapRootCnfUrl}
47         heat:
48           access_key_id:
49             Ref: ApiKey
50           secret_key:
51             Fn::GetAtt: [ ApiKey, SecretAccessKey ]
52           stack:
53             name: {Ref: 'AWS::StackName'}
54             region: {Ref: 'AWS::Region'}
55           refresh:
56             - resource: MySQL
57     Properties:
58       ImageId:
59         {Ref: MySQLImage}
60       InstanceType: {Ref: InstanceType}
61       KeyName: {Ref: KeyName}
62   KeystonePasswordHandle:
63     Type: AWS::CloudFormation:WaitConditionHandle
64     Properties:
65   KeystonePassword:
66     DependsOn: MySQL
67     Type: AWS::CloudFormation::WaitCondition
68     Properties:
69       Handle: {Ref: KeystonePasswordHandle}
70       Timeout: 60
71 Outputs:
72     MySQLHost: 
73         Fn::GetAtt: [ MySQL , PrivateIp ]
74     KeystonePassword:
75         Fn::GetAtt: [ KeystonePassword, Data ]
76     KeystoneUser: {Ref: KeystoneUser}