From 77069eefd54b291b28edce2fcd275bb2bcf619d2 Mon Sep 17 00:00:00 2001 From: Steven Hardy Date: Fri, 2 Nov 2012 08:57:52 +0000 Subject: [PATCH] heat templates : Align AutoScaling template with cfntools Updated cfntools require authentication for cfn-push-stats, so the AutoScaling template needs the user/key and boto.cfg additions, same as in the HA templates, otherwise cfn-push-stats, and hence autoscaling doesn't work Change-Id: Ib3ef4a932bb656f29e25ef745409f5fe3e82c356 Signed-off-by: Steven Hardy --- templates/AutoScalingMultiAZSample.template | 24 +++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/templates/AutoScalingMultiAZSample.template b/templates/AutoScalingMultiAZSample.template index 3cef664b..abe8aca0 100644 --- a/templates/AutoScalingMultiAZSample.template +++ b/templates/AutoScalingMultiAZSample.template @@ -93,6 +93,15 @@ }, "Resources" : { + "CfnUser" : { + "Type" : "AWS::IAM::User" + }, + "WebServerKeys" : { + "Type" : "AWS::IAM::AccessKey", + "Properties" : { + "UserName" : {"Ref": "CfnUser"} + } + }, "WebServerGroup" : { "Type" : "AWS::AutoScaling::AutoScalingGroup", "Properties" : { @@ -190,6 +199,16 @@ "AWS::CloudFormation::Init" : { "config" : { "files" : { + "/etc/cfn/cfn-credentials" : { + "content" : { "Fn::Join" : ["", [ + "AWSAccessKeyId=", { "Ref" : "WebServerKeys" }, "\n", + "AWSSecretKey=", {"Fn::GetAtt": ["WebServerKeys", + "SecretAccessKey"]}, "\n" + ]]}, + "mode" : "000400", + "owner" : "root", + "group" : "root" + }, "/tmp/setup.mysql" : { "content" : { "Fn::Join" : ["", [ "CREATE DATABASE ", { "Ref" : "DBName" }, ";\n", @@ -248,6 +267,11 @@ " -r LaunchConfig ", " --region ", { "Ref" : "AWS::Region" }, "\n", + "# Update boto config (template created by heat-jeos tdl)\n", + "sed -i \"s/__GATEWAY_IP__/", + "$(/sbin/ip route | grep \"^default\" | awk '{print $3}')/\"", + " /etc/boto.cfg \n", + "# Setup MySQL root password and create a user\n", "mysqladmin -u root password '", { "Ref" : "DBRootPassword" }, "'\n", -- 2.45.2