summaryrefslogtreecommitdiff
path: root/global/overlay/etc/puppet/modules/sunet/manifests
diff options
context:
space:
mode:
authorLeif Johansson <leifj@sunet.se>2015-03-06 15:57:59 +0100
committerLeif Johansson <leifj@sunet.se>2015-03-06 15:57:59 +0100
commit4d61dc46736aaec1cb7d26897ab83f03c4d7acfc (patch)
treeb6d575e7805bcdc2103e86d337c50405b03582f5 /global/overlay/etc/puppet/modules/sunet/manifests
parent39aa967b42579a60160a3d0ca9b07ac5dcf93ad8 (diff)
Diffstat (limited to 'global/overlay/etc/puppet/modules/sunet/manifests')
-rw-r--r--global/overlay/etc/puppet/modules/sunet/manifests/wordpress.pp28
1 files changed, 12 insertions, 16 deletions
diff --git a/global/overlay/etc/puppet/modules/sunet/manifests/wordpress.pp b/global/overlay/etc/puppet/modules/sunet/manifests/wordpress.pp
index 883e537..3a3d565 100644
--- a/global/overlay/etc/puppet/modules/sunet/manifests/wordpress.pp
+++ b/global/overlay/etc/puppet/modules/sunet/manifests/wordpress.pp
@@ -1,41 +1,37 @@
# a basic wp setup using docker
define sunet::wordpress (
-$name = undef,
$db_host = undef,
$wordpress_version = "4.1.1",
$myqsl_version = "5.7")
{
$db_hostname = $db_host ? {
- undef => "mysql_${sanitized_name}.docker",
+ undef => "mysql_${name}.docker",
default => $db_host
}
- $sanitized_name = regsubst($name, '[^0-9A-Za-z.\-]', '-', 'G')
- $pwd = hiera('${sanitized_name}_db_password','NOT_SET_IN_HIERA')
- file {"/data/${sanitized_name}/html": ensure => directory }
- sunet::docker_run {
- name => "wordpress_${sanitized_name}",
+ $pwd = hiera("${name}_db_password",'NOT_SET_IN_HIERA')
+ file {"/data/${name}/html": ensure => directory }
+ sunet::docker_run { "${name}_wordpress":
image => "wordpress",
imagetag => $wordpress_version,
- volumes => ["/data/${sanitized_name}/html:/var/www/html"],
+ volumes => ["/data/${name}/html:/var/www/html"],
port => ["8080:80"],
environment => [ "WORDPRESS_DB_HOST=${db_hostname}",
- "WORDPRESS_DB_USER=${sanitized_name}",
- "WORDPRESS_DB_NAME=${sanitized_name}",
+ "WORDPRESS_DB_USER=${name}",
+ "WORDPRESS_DB_NAME=${name}",
"WORDPRESS_DB_PASSWORD=${pwd}" ]
}
if (!$db_host) {
- file {"/data/${sanitized_name}/db": ensure => directory }
- sunet::docker_run {
- name => "mysql_${sanitized_name}",
+ file {"/data/${name}/db": ensure => directory }
+ sunet::docker_run { "${name}_mysql":
image => "mysql",
imagetag => $mysql_version,
- volumes => ["/data/${sanitized_name}/db:/var/lib/mysql"],
- environment => ["MYSQL_USER=${sanitized_name}",
+ volumes => ["/data/${name}/db:/var/lib/mysql"],
+ environment => ["MYSQL_USER=${name}",
"MYSQL_PASSWORD=${pwd}",
"MYSQL_ROOT_PASSWORD=${pwd}",
- "MYSQL_DATABASE=${sanitized_name}"]
+ "MYSQL_DATABASE=${name}"]
}
}
}