update comment in the template
[heat-templates.git] / staging / wordpress-single.template
blobbf37e5910d9b1ee78b4451866fd79470bd331deb
1 heat_template_version: 2013-05-23
3 description: |
4   A template implementation of a resource that provides a Wordpress blog server
6 parameters:
8   flavor:
9     description: Rackspace Cloud Server flavor
10     type: string 
11     default: 1GB Standard Instance
12     constraints:
13     - allowed_values:
14       - 512MB Standard Instance
15       - 1GB Standard Instance
16       - 2GB Standard Instance
17       - 4GB Standard Instance
18       - 8GB Standard Instance
19       - 15GB Standard Instance
20       - 30GB Standard Instance 
21       description: must be a valid Rackspace Cloud Server flavor.
23   server_name:
24     description: the instance name
25     type: string
26     default: Wordpress Webserver
28   key_name:
29     description: Nova keypair name for ssh access to the server
30     type: string
32   db_host:
33     description: The database hostname
34     type: string
35     default: localhost
37   db_name:
38     default: wordpress
39     description: The WordPress database name
40     type: string
41     constraints:
42     - length:
43         min: 1
44         max: 64
45       description: must be from 1 to 64 characters
46     - allowed_pattern: "[a-zA-Z][a-zA-Z0-9]*"
47       description: must begin with a letter and contain only alphanumeric characters.
49   db_username:
50     default: admin
51     hidden: true
52     description: The WordPress database admin account username
53     type: string
54     constraints:
55     - length:
56         min: 1
57         max: 16
58       description: must be from 1 to 16 characters
59     - allowed_pattern: "[a-zA-Z][a-zA-Z0-9]*"
60       description: must begin with a letter and contain only alphanumeric characters.
62   db_password:
63     default: admin
64     hidden: true
65     description: The WordPress database admin account password
66     type: string
67     constraints:
68     - length:
69         min: 1
70         max: 41
71       description: must be between 1 and 41 characters
72     - allowed_pattern: "[a-zA-Z0-9]*"
73       description : must contain only alphanumeric characters.
75 resources:
77   wordpress: 
78     type: "Rackspace::Cloud::Server"
79     properties:
80       flavor: { get_param: flavor }
81       # only tested on Fedora at the moment
82       image: fd8e4f18-9270-4f43-8932-c3719ae2f7fd  # CentOS 6.5
83       name: { get_param: server_name }
84       key_name: { get_param: key_name }
85       user_data:
86         str_replace:
87           template: |
88             #!/bin/bash -v
89             yum -y install mysql-server httpd wordpress
90             sed -i "/Deny from All/d" /etc/httpd/conf.d/wordpress.conf
91             sed -i "s/Require local/Require all granted/" /etc/httpd/conf.d/wordpress.conf
92             sed --in-place --e "s/localhost/%dbhost%/" --e "s/database_name_here/%dbname%/" --e "s/username_here/%dbuser%/" --e "s/password_here/%dbpass%/" /usr/share/wordpress/wp-config.php
93             /etc/init.d/httpd start
94             chkconfig httpd on
95             /etc/init.d/mysqld start
96             chkconfig mysqld on
97             cat << EOF | mysql
98             CREATE DATABASE %dbname%;
99             GRANT ALL PRIVILEGES ON %dbname%.* TO "%dbuser%"@"localhost"
100             IDENTIFIED BY "%dbpass%";
101             FLUSH PRIVILEGES;
102             EXIT
103             EOF
104             iptables -I INPUT -p tcp --dport 80 -j ACCEPT
105             iptables-save > /etc/sysconfig/iptables
106           params:
107             "%dbhost%": { get_param: db_host }
108             "%dbname%": { get_param: db_name }
109             "%dbuser%": { get_param: db_username }
110             "%dbpass%": { get_param: db_password }
112 outputs:
113   
114   public_ip:
115     value: { get_attr: [ wordpress, accessIPv4 ] }
116     description: The public ip address of the server
118   private_ip:
119     value: { get_attr: [ wordpress, privateIPv4 ] }
120     description: The private ip address of the server
122   website_url:
123     value:
124       str_replace:
125         template: http://%ip%/wordpress
126         params:
127           "%ip%": { get_attr: [ wordpress, accessIPv4 ] }
128     description: URL for Wordpress wiki