Created
April 17, 2014 12:27
-
-
Save fcharlier/10979494 to your computer and use it in GitHub Desktop.
Some Heat HOT templates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
heat_template_version: 2013-05-23 | |
description: > | |
Heat WordPress template to support Ubuntu, using only Heat OpenStack-native | |
resource types, and without the requirement for heat-cfntools in the image. | |
WordPress is web software you can use to create a beautiful website or blog. | |
This template installs a single-instance WordPress deployment using a local | |
MySQL database to store the data. | |
parameters: | |
key_name: | |
type: string | |
description : Name of a KeyPair to enable SSH access to the instance | |
instance_type: | |
type: string | |
description: Instance type for WordPress server | |
default: m1.medium | |
constraints: | |
- allowed_values: [m1.small, m1.medium, m1.large] | |
description: instance_type must be one of m1.small, m1.medium or m1.large | |
image_id: | |
type: string | |
description: ID of the image to use for the WordPress server | |
default: "Ubuntu 12.04 amd64" | |
db_name: | |
type: string | |
description: WordPress database name | |
default: wordpress | |
constraints: | |
- length: { min: 1, max: 64 } | |
description: db_name must be between 1 and 64 characters | |
- allowed_pattern: '[a-zA-Z][a-zA-Z0-9]*' | |
description: > | |
db_name must begin with a letter and contain only alphanumeric | |
characters | |
db_username: | |
type: string | |
description: The WordPress database admin account username | |
default: admin | |
hidden: true | |
constraints: | |
- length: { min: 1, max: 16 } | |
description: db_username must be between 1 and 64 characters | |
- allowed_pattern: '[a-zA-Z][a-zA-Z0-9]*' | |
description: > | |
db_username must begin with a letter and contain only alphanumeric | |
characters | |
db_password: | |
type: string | |
description: The WordPress database admin account password | |
default: admin | |
hidden: true | |
constraints: | |
- length: { min: 1, max: 41 } | |
description: db_username must be between 1 and 64 characters | |
- allowed_pattern: '[a-zA-Z0-9]*' | |
description: db_password must contain only alphanumeric characters | |
db_root_password: | |
type: string | |
description: Root password for MySQL | |
default: admin | |
hidden: true | |
constraints: | |
- length: { min: 1, max: 41 } | |
description: db_username must be between 1 and 64 characters | |
- allowed_pattern: '[a-zA-Z0-9]*' | |
description: db_password must contain only alphanumeric characters | |
public_net_id: | |
type: string | |
description: > | |
ID of the public network for which floating IP addresses will be allocated | |
private_net_name: | |
type: string | |
description: Name of the private network to be created | |
default: dmz_net | |
private_net_cidr: | |
type: string | |
description: Private network address (CIDR notation) | |
default: 192.168.42.0/24 | |
private_net_gateway: | |
type: string | |
description: Private network gateway address | |
default: 192.168.42.1 | |
private_net_pool_start: | |
type: string | |
description: Start of private network IP address allocation pool | |
default: 192.168.42.2 | |
private_net_pool_end: | |
type: string | |
description: End of private network IP address allocation pool | |
default: 192.168.42.254 | |
resources: | |
private_net: | |
type: OS::Neutron::Net | |
properties: | |
name: { get_param: private_net_name } | |
private_subnet: | |
type: OS::Neutron::Subnet | |
properties: | |
network_id: { get_resource: private_net } | |
cidr: { get_param: private_net_cidr } | |
gateway_ip: { get_param: private_net_gateway } | |
allocation_pools: | |
- start: { get_param: private_net_pool_start } | |
end: { get_param: private_net_pool_end } | |
router: | |
type: OS::Neutron::Router | |
router_gateway: | |
type: OS::Neutron::RouterGateway | |
properties: | |
router_id: { get_resource: router } | |
network_id: { get_param: public_net_id } | |
router_interface: | |
type: OS::Neutron::RouterInterface | |
properties: | |
router_id: { get_resource: router } | |
subnet_id: { get_resource: private_subnet } | |
wordpress_instance: | |
type: OS::Nova::Server | |
properties: | |
image: { get_param: image_id } | |
flavor: { get_param: instance_type } | |
key_name: { get_param: key_name } | |
networks: | |
- port: { get_resource: wordpress_instance_port } | |
user_data: | |
str_replace: | |
template: | | |
#!/bin/bash -v | |
apt-get -y update | |
echo mysql-server mysql-server/root_password select db_rootpassword | debconf-set-selections | |
echo mysql-server mysql-server/root_password_again select db_rootpassword | debconf-set-selections | |
apt-get -y install mysql-server apache2 wordpress | |
cat > /etc/apache2/conf.d/wordpress.conf <<EOF | |
Alias /wordpress /usr/share/wordpress | |
<Directory /usr/share/wordpress> | |
AllowOverride Options | |
</Directory> | |
EOF | |
bash /usr/share/doc/wordpress/examples/setup-mysql -n db_name 127.0.0.1 | |
mv /etc/wordpress/config-127.0.0.1.php /etc/wordpress/config-floating_ip.php | |
service apache2 restart | |
params: | |
db_rootpassword: { get_param: db_root_password } | |
db_name: { get_param: db_name } | |
db_user: { get_param: db_username } | |
db_password: { get_param: db_password } | |
floating_ip: { get_attr: [wordpress_instance_floating_ip, floating_ip_address] } | |
wordpress_instance_port: | |
type: OS::Neutron::Port | |
properties: | |
network_id: { get_resource: private_net } | |
# security_groups: [ '278faca0-c4e1-46f7-9f0b-11734470bc67' ] | |
fixed_ips: | |
- subnet_id: { get_resource: private_subnet } | |
wordpress_instance_floating_ip: | |
type: OS::Neutron::FloatingIP | |
properties: | |
floating_network_id: { get_param: public_net_id } | |
port_id: { get_resource: wordpress_instance_port } | |
outputs: | |
WebsiteURL: | |
description: URL for Wordpress wiki | |
value: | |
str_replace: | |
template: http://host/wordpress | |
params: | |
host: { get_attr: [wordpress_instance_floating_ip, floating_ip_address] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
heat_template_version: 2013-05-23 | |
description: > | |
Heat WordPress template to support Ubuntu, using only Heat OpenStack-native | |
resource types, and without the requirement for heat-cfntools in the image. | |
WordPress is web software you can use to create a beautiful website or blog. | |
This template installs a single-instance WordPress deployment using a local | |
MySQL database to store the data. And a second instance potentially hosting | |
the database. | |
parameters: | |
key_name: | |
type: string | |
description : Name of a KeyPair to enable SSH access to the instance | |
instance_type: | |
type: string | |
description: Instance type for WordPress server | |
default: m1.medium | |
constraints: | |
- allowed_values: [m1.small, m1.medium, m1.large] | |
description: instance_type must be one of m1.small, m1.medium or m1.large | |
image_id: | |
type: string | |
description: ID of the image to use for the WordPress server | |
default: "Ubuntu 12.04 amd64" | |
db_name: | |
type: string | |
description: WordPress database name | |
default: wordpress | |
constraints: | |
- length: { min: 1, max: 64 } | |
description: db_name must be between 1 and 64 characters | |
- allowed_pattern: '[a-zA-Z][a-zA-Z0-9]*' | |
description: > | |
db_name must begin with a letter and contain only alphanumeric | |
characters | |
db_username: | |
type: string | |
description: The WordPress database admin account username | |
default: admin | |
hidden: true | |
constraints: | |
- length: { min: 1, max: 16 } | |
description: db_username must be between 1 and 64 characters | |
- allowed_pattern: '[a-zA-Z][a-zA-Z0-9]*' | |
description: > | |
db_username must begin with a letter and contain only alphanumeric | |
characters | |
db_password: | |
type: string | |
description: The WordPress database admin account password | |
default: admin | |
hidden: true | |
constraints: | |
- length: { min: 1, max: 41 } | |
description: db_username must be between 1 and 64 characters | |
- allowed_pattern: '[a-zA-Z0-9]*' | |
description: db_password must contain only alphanumeric characters | |
db_root_password: | |
type: string | |
description: Root password for MySQL | |
default: admin | |
hidden: true | |
constraints: | |
- length: { min: 1, max: 41 } | |
description: db_username must be between 1 and 64 characters | |
- allowed_pattern: '[a-zA-Z0-9]*' | |
description: db_password must contain only alphanumeric characters | |
public_net_id: | |
type: string | |
description: > | |
ID of the public network for which floating IP addresses will be allocated | |
private_net_name: | |
type: string | |
description: Name of the private network to be created | |
default: dmz_net | |
private_net_cidr: | |
type: string | |
description: Private network address (CIDR notation) | |
default: 192.168.42.0/24 | |
private_net_gateway: | |
type: string | |
description: Private network gateway address | |
default: 192.168.42.1 | |
private_net_pool_start: | |
type: string | |
description: Start of private network IP address allocation pool | |
default: 192.168.42.2 | |
private_net_pool_end: | |
type: string | |
description: End of private network IP address allocation pool | |
default: 192.168.42.254 | |
db_net_name: | |
type: string | |
description: Name of the db network to be created | |
default: db_net | |
db_net_cidr: | |
type: string | |
description: db network address (CIDR notation) | |
default: 192.168.43.0/24 | |
db_net_gateway: | |
type: string | |
description: db network gateway address | |
default: 192.168.43.1 | |
db_net_pool_start: | |
type: string | |
description: Start of db network IP address allocation pool | |
default: 192.168.43.2 | |
db_net_pool_end: | |
type: string | |
description: End of db network IP address allocation pool | |
default: 192.168.43.254 | |
resources: | |
private_net: | |
type: OS::Neutron::Net | |
properties: | |
name: { get_param: private_net_name } | |
private_subnet: | |
type: OS::Neutron::Subnet | |
properties: | |
network_id: { get_resource: private_net } | |
cidr: { get_param: private_net_cidr } | |
gateway_ip: { get_param: private_net_gateway } | |
allocation_pools: | |
- start: { get_param: private_net_pool_start } | |
end: { get_param: private_net_pool_end } | |
db_net: | |
type: OS::Neutron::Net | |
properties: | |
name: { get_param: db_net_name } | |
db_subnet: | |
type: OS::Neutron::Subnet | |
properties: | |
network_id: { get_resource: db_net } | |
cidr: { get_param: db_net_cidr } | |
gateway_ip: { get_param: db_net_gateway } | |
allocation_pools: | |
- start: { get_param: db_net_pool_start } | |
end: { get_param: db_net_pool_end } | |
router: | |
type: OS::Neutron::Router | |
router_gateway: | |
type: OS::Neutron::RouterGateway | |
properties: | |
router_id: { get_resource: router } | |
network_id: { get_param: public_net_id } | |
router_interface_private: | |
type: OS::Neutron::RouterInterface | |
properties: | |
router_id: { get_resource: router } | |
subnet_id: { get_resource: private_subnet } | |
router_interface_db: | |
type: OS::Neutron::RouterInterface | |
properties: | |
router_id: { get_resource: router } | |
subnet_id: { get_resource: db_subnet } | |
wordpress_instance: | |
type: OS::Nova::Server | |
properties: | |
image: { get_param: image_id } | |
flavor: { get_param: instance_type } | |
key_name: { get_param: key_name } | |
networks: | |
- port: { get_resource: wordpress_instance_port } | |
user_data: | |
str_replace: | |
template: | | |
#!/bin/bash -v | |
#apt-get -y update | |
echo mysql-server mysql-server/root_password select db_rootpassword | debconf-set-selections | |
echo mysql-server mysql-server/root_password_again select db_rootpassword | debconf-set-selections | |
apt-get -y install mysql-server apache2 wordpress | |
cat > /etc/apache2/conf.d/wordpress.conf <<EOF | |
Alias /wordpress /usr/share/wordpress | |
<Directory /usr/share/wordpress> | |
AllowOverride Options | |
</Directory> | |
EOF | |
bash /usr/share/doc/wordpress/examples/setup-mysql -n db_name 127.0.0.1 | |
mv /etc/wordpress/config-127.0.0.1.php /etc/wordpress/config-floating_ip.php | |
service apache2 restart | |
params: | |
db_rootpassword: { get_param: db_root_password } | |
db_name: { get_param: db_name } | |
db_user: { get_param: db_username } | |
db_password: { get_param: db_password } | |
floating_ip: { get_attr: [wordpress_instance_floating_ip, floating_ip_address] } | |
wordpress_instance_port: | |
type: OS::Neutron::Port | |
properties: | |
network_id: { get_resource: private_net } | |
# security_groups: [ '278faca0-c4e1-46f7-9f0b-11734470bc67' ] | |
fixed_ips: | |
- subnet_id: { get_resource: private_subnet } | |
wordpress_instance_floating_ip: | |
type: OS::Neutron::FloatingIP | |
properties: | |
floating_network_id: { get_param: public_net_id } | |
port_id: { get_resource: wordpress_instance_port } | |
db_instance: | |
type: OS::Nova::Server | |
properties: | |
image: { get_param: image_id } | |
flavor: { get_param: instance_type } | |
key_name: { get_param: key_name } | |
networks: | |
- port: { get_resource: db_instance_port } | |
db_instance_port: | |
type: OS::Neutron::Port | |
properties: | |
network_id: { get_resource: db_net } | |
# security_groups: [ '278faca0-c4e1-46f7-9f0b-11734470bc67' ] | |
fixed_ips: | |
- subnet_id: { get_resource: db_subnet } | |
outputs: | |
WebsiteURL: | |
description: URL for Wordpress wiki | |
value: | |
str_replace: | |
template: http://host/wordpress | |
params: | |
host: { get_attr: [wordpress_instance_floating_ip, floating_ip_address] } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment