forked from tstlam/templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ubuntu_fixedip_in_res.yaml
152 lines (142 loc) · 4.82 KB
/
ubuntu_fixedip_in_res.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
heat_template_version: 2013-05-23
description: >
Heat WordPress template to support F18, 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
default: lxiaojun
instance_type:
type: string
description: Instance type for WordPress server
default: m1.small
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-1404
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: Passw0rd
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
root_password:
type: string
description: Root password
default: Passw0rd
hidden: true
constraints:
- length: { min: 1, max: 41 }
description: root_password must be between 1 and 64 characters
- allowed_pattern: '[a-zA-Z0-9]*'
description: root_password must contain only alphanumeric characters
network_id:
type: string
description: name of network
default: private_network_1
ip_address:
type: string
description: ip address of network
default: 11.1.0.99
resources:
# server_port:
# type: OS::Neutron::Port
# properties:
# network_id: { get_param: network_id }
# fixed_ips:
# - ip_address: { get_param: ip_address }
wordpress_instance:
type: OS::Nova::Server
properties:
image: { get_param: image_id }
flavor: { get_param: instance_type }
key_name: { get_param: key_name }
networks:
- network: { get_param: network_id }
fixed_ip: { get_param: ip_address }
user_data:
str_replace:
template: |
#!/bin/bash -v
cat << EOF | passwd root
root_password
root_password
EOF
chkconfig mysql on
service mysql restart
# Setup MySQL root password and create a user
cat << EOF | mysql -uroot
UPDATE mysql.user SET Password=PASSWORD('db_rootpassword') WHERE User='root';
CREATE DATABASE db_name;
GRANT ALL PRIVILEGES ON db_name.* TO "db_user"@"localhost"
IDENTIFIED BY "db_password";
FLUSH PRIVILEGES;
EXIT
EOF
cat << EOF > /etc/networks/interfaces.d/eth0.cfg
auto eth0
iface eth0 inet static
address ip_addr
netmask 255.255.255.0
EOF
chkconfig apache2 on
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 }
root_password: { get_param: root_password }
ip_addr: { get_param: ip_address }
outputs:
WebsiteURL:
description: URL for Wordpress wiki
value:
str_replace:
template: http://host/wordpress
params:
host: { get_attr: [wordpress_instance, first_address] }