Skip to content

Instantly share code, notes, and snippets.

@therve
Created February 26, 2014 15:15
Show Gist options
  • Select an option

  • Save therve/9231284 to your computer and use it in GitHub Desktop.

Select an option

Save therve/9231284 to your computer and use it in GitHub Desktop.
heat_template_version: 2013-05-23
resources:
mydb:
type: OS::DBInstance
properties:
database_name: wordpress
database_user: wordpress
database_password: wordpress_password
database_root_password: root_password
myserver:
type: OS::Nova::Server
Metadata:
AWS::CloudFormation::Init:
config:
packages:
yum:
httpd: []
wordpress: []
services:
systemd:
httpd: {enabled: 'true', ensureRunning: 'true'}
properties:
flavor: m1.small
image: Fedora-x86_64-20-20131211.1-sda
key_name: heat
user_data:
str_replace:
template: |
#!/bin/bash -v
/opt/aws/bin/cfn-init
firewall-cmd --add-service=http
firewall-cmd --permanent --add-service=http
setsebool -P httpd_can_network_connect_db=1
sed -i "/Deny from All/d" /etc/httpd/conf.d/wordpress.conf
sed -i "s/Require local/Require all granted/" /etc/httpd/conf.d/wordpress.conf
sed -i s/database_name_here/wordpress/ /etc/wordpress/wp-config.php
sed -i s/username_here/wordpress/ /etc/wordpress/wp-config.php
sed -i s/password_here/wordpress_password/ /etc/wordpress/wp-config.php
sed -i s/localhost/$db_host/ /etc/wordpress/wp-config.php
systemctl restart httpd.service
params:
$db_host: {get_attr: [mydb, server_address]}
outputs:
server_address:
value: {get_attr: [myserver, first_address]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment