diff options
author | Leif Johansson <leifj@sunet.se> | 2015-03-06 13:35:02 +0100 |
---|---|---|
committer | Leif Johansson <leifj@sunet.se> | 2015-03-06 13:35:02 +0100 |
commit | 7c95885246afdb88adbcdaae60c68991facaddea (patch) | |
tree | 5a5d9f4fa6b79686b8ce612814838c2a7df9773e /global | |
parent | ded169d0274e293686aad1e08d1234945a067b38 (diff) |
wp configsunet-ops-2015-03-06-v07
Diffstat (limited to 'global')
-rw-r--r-- | global/overlay/etc/puppet/modules/sunet/manifests/wordpress.pp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/global/overlay/etc/puppet/modules/sunet/manifests/wordpress.pp b/global/overlay/etc/puppet/modules/sunet/manifests/wordpress.pp new file mode 100644 index 0000000..25fba72 --- /dev/null +++ b/global/overlay/etc/puppet/modules/sunet/manifests/wordpress.pp @@ -0,0 +1,31 @@ +# a basic wp setup using docker + +define sunet::wordpress ($name => undef, $wordpress_version => "4.1.1", $myqsl_version="5.7", $db_host => undef) { + $db_hostname = $db_host ? $db_host : "mysql_${sanitized_name}.docker" + $sanitized_name = regsubst($name, '[^0-9A-Za-z.\-]', '-', 'G') + $pwd = hiera('${sanitized_name}_db_password','NOT_SET_IN_HIERA') + sunet::docker_run { + name => "wordpress_${sanitized_name}", + image => "wordpress", + imagetag => $wordpress_version, + volumes => ["/data/${sanitized_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_PASSWORD=${pwd}" ] + } + + if (!$db_host) { + sunet::docker_run { + name => "mysql_${sanitized_name}", + image => "mysql", + imagetag => $mysql_version, + volumes => ["/data/${sanitized_name}/db":"/var/lib/mysql"], + environment => ["MYSQL_USER=${sanitized_name}", + "MYSQL_PASSWORD=${pwd}", + "MYSQL_ROOT_PASSWORD=${pwd}", + "MYSQL_DATABASE=${sanitized_name}"] + } + } +} |