]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Add cfn-hup config into template
authorAngus Salkeld <asalkeld@redhat.com>
Thu, 26 Apr 2012 07:01:13 +0000 (17:01 +1000)
committerAngus Salkeld <asalkeld@redhat.com>
Thu, 26 Apr 2012 07:04:03 +0000 (17:04 +1000)
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
templates/WordPress_Single_Instance_With_HA.template

index c3287553e81d4c436555e2ee8c03a57bafe8a623..8606d9dfbf91e9dc3505f08d7f3b845d2aaa5721 100644 (file)
       "Description" : "Distribution of choice",
       "Type": "String",
       "AllowedValues" : [ "F16", "F17", "U10", "RHEL-6.1", "RHEL-6.2", "RHEL-6.3" ]
+    },
+    "HupPollInterval": {
+      "Default": "1",
+      "Description" : "Interval for cfn-hup",
+      "Type": "String"
     }
   },
 
       "Metadata" : {
         "AWS::CloudFormation::Init" : {
           "config" : {
+            "files" : {
+              "/etc/cfn/cfn-credentials" : {
+                "content" : { "Fn::Join" : ["", [
+                  "AWSAccessKeyId=GobbleGobble\n",
+                  "AWSSecretKey=Fn_GetAtt_WebServerKeys_SecretAccessKey\n"
+                ]]},
+                "mode"    : "000400",
+                "owner"   : "root",
+                "group"   : "root"
+              },
+
+              "/etc/cfn/cfn-hup.conf" : {
+                "content" : { "Fn::Join" : ["", [
+                  "[main]\n",
+                  "stack=", { "Ref" : "AWS::StackName" }, "\n",
+                  "credential-file=/etc/cfn/cfn-credentials\n",
+                  "region=", { "Ref" : "AWS::Region" }, "\n",
+                  "interval=", { "Ref" : "HupPollInterval" }, "\n"
+                ]]},
+                "mode"    : "000400",
+                "owner"   : "root",
+                "group"   : "root"
+              },
+
+              "/etc/cfn/notify-on-httpd-restarted" : {
+                "content" : "logger -t cfn-event 'http got restarted'\n",
+                "mode"    : "000500",
+                "owner"   : "root",
+                "group"   : "root"
+              },
+
+              "/tmp/cfn-hup-crontab.txt" : {
+                "content" : { "Fn::Join" : ["", [
+                "MAIL=\n",
+                "* * * * * /opt/aws/bin/cfn-hup -f\n"
+                ]]},
+                "mode"    : "000600",
+                "owner"   : "root",
+                "group"   : "root"
+              },
+
+              "/etc/cfn/hooks.conf" : {
+                "content": { "Fn::Join" : ["", [
+                  "[cfn-http-restarted]\n",
+                  "triggers=service.restarted\n",
+                  "path=Resources.WikiDatabase.Metadata\n",
+                  "action=/etc/cfn/notify-on-httpd-restarted\n",
+                  "runas=root\n"
+                ]]},
+                "mode"    : "000400",
+                "owner"   : "root",
+                "group"   : "root"
+              }
+            },
             "packages" : {
               "yum" : {
+                "cronie"       : [],
                 "mysql"        : [],
                 "mysql-server" : [],
                 "httpd"        : [],
             "services" : {
               "systemd" : {
                 "mysqld"   : { "enabled" : "true", "ensureRunning" : "true" },
-                "httpd"    : { "enabled" : "true", "ensureRunning" : "true" }
+                "httpd"    : { "enabled" : "true", "ensureRunning" : "true" },
+                "crond"    : { "enabled" : "true", "ensureRunning" : "true" }
               }
             }
           }
           "FLUSH PRIVILEGES;\n",
           "EXIT\n",
           "EOF\n",
-          "sed --in-place --e s/database_name_here/", { "Ref" : "DBName" }, "/ --e s/username_here/", { "Ref" : "DBUsername" }, "/ --e s/password_here/", { "Ref" : "DBPassword" }, "/ /usr/share/wordpress/wp-config.php\n"
+          "sed --in-place --e s/database_name_here/", { "Ref" : "DBName" }, "/ --e s/username_here/", { "Ref" : "DBUsername" }, "/ --e s/password_here/", { "Ref" : "DBPassword" }, "/ /usr/share/wordpress/wp-config.php\n",
+
+          "# install cfn-hup crontab\n",
+          "crontab /tmp/cfn-hup-crontab.txt\n"
         ]]}}
       }
     }