works but missing stuff
[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: bm.small
12   MySQLImage:
13     Type: String
14   BootstrapUrl:
15     Description: Fetch a mysql dump file from this URL and load it
16     Type: String
17     Default: ''
18   BootstrapRootCnfUrl:
19     Description: Fetch a mysql config file from this URL to setup local root with bootstrapped database
20     Type: String
21     Default: ''
22 Resources:
23   ApiAccessPolicy:
24     Type: OS::Heat::AccessPolicy
25     Properties:
26       AllowedResources: [ MySQL ]
27   ApiUser:
28     Type: AWS::IAM::User
29     Properties:
30       Policies: [ { Ref: ApiAccessPolicy } ]
31   ApiKey:
32     Type: AWS::IAM::AccessKey
33     Properties:
34       UserName:
35         Ref: ApiUser
36   MySQL:
37     Type: AWS::EC2::Instance
38     Metadata:
39       OpenStack::ImageBuilder::Elements: [ mysql ]
40       OpenStack::Config:
41         mysql:
42           users:
43             - database: keystone
44           bootstrap_url: {Ref: BootstrapUrl}
45           root_cnf_url: {Ref: BootstrapRootCnfUrl}
46         heat:
47           access_key_id:
48             Ref: ApiKey
49           secret_key:
50             Fn::GetAtt: [ ApiKey, SecretAccessKey ]
51           stack:
52             name: {Ref: 'AWS::StackName'}
53             region: {Ref: 'AWS::Region'}
54           refresh:
55             - resource: MySQL
56     Properties:
57       ImageId:
58         {Ref: MySQLImage}
59       InstanceType: {Ref: InstanceType}
60       KeyName: {Ref: KeyName}
61       UserData: "#!/bin/bash\ntouch /tmp/userdata-finished\necho Userdata finished $(date)\n"
62 Outputs:
63     MySQLHost: 
64         Fn::GetAtt: [ MySQL , PrivateIp ]