Index: modules/adblockplus/manifests/web/static.pp |
=================================================================== |
new file mode 100644 |
--- /dev/null |
+++ b/modules/adblockplus/manifests/web/static.pp |
@@ -0,0 +1,82 @@ |
+# == Class: adblockplus::web::static |
+# |
+# Manage a simple Nginx-based webserver for static content |
+# that uses a customizable deployment script to e.g. fetch the content |
+# from a repository server (ref. http://hub.eyeo.com/issues/4523) |
+# |
+# |
+# === Parameters: |
mathias
2018/03/27 14:46:51
Incomplete.
f.lopez
2018/03/27 19:29:50
Acknowledged.
|
+# |
+# [*domain*] |
+# The domain name for the website. |
+# |
+# [*ssl_certificate*] |
+# The name of the SSL certificate file within modules/private/files, if any. |
+# Requires a private_key as well. |
+# |
+# [*ssl_private_key*] |
+# The name of the private key file within modules/private/files, if any. |
+# Requires a certificate as well. |
+# |
+# [*ensure*] |
+# Whether to set up the website or not. |
+# |
+# [*hooks*] |
+# Hash of adblockplus::web::static::hook items to set up in this context. |
+# |
+# === Examples: |
+# |
+# class {'adblockplus::web::static': |
+# domain => 'help.eyeo.com', |
+# hooks => { |
+# deploy => { |
+# file => { |
+# content => 'uname -a', |
mathias
2018/03/27 14:46:51
That is a quite strange "deploy" example.
f.lopez
2018/03/27 19:29:50
heh :), I'll change the name of the example :D
|
+# } |
+# } |
+# }, |
+# } |
+# |
+class adblockplus::web::static ( |
+ $domain = undef, |
mathias
2018/03/27 14:46:50
A required parameter shall not default to anything
f.lopez
2018/03/27 19:29:50
Acknowledged.
|
+ $ssl_certificate = undef, |
+ $ssl_private_key = undef, |
+ $ensure = 'present', |
+ $deploy_user = 'web-deploy', |
+ $deploy_user_authorized_keys = undef, |
+ $hooks = {}, |
+) { |
+ |
+ include adblockplus::web |
+ include nginx |
+ include geoip |
+ include ssh |
+ |
+ ensure_resource('file', "/var/www/$domain", { |
+ ensure => ensure_directory_state($ensure), |
+ mode => '0775', |
+ owner => www-data, |
+ group => www-data, |
+ }) |
+ |
+ ensure_resource('nginx::hostconfig', $title, { |
+ content => template('adblockplus/web/static.conf.erb'), |
+ certificate => $ssl_certificate, |
+ domain => $domain, |
+ is_default => $is_default, |
mathias
2018/03/27 14:46:50
is_undef
f.lopez
2018/03/27 19:29:49
Acknowledged.
|
+ private_key => $ssl_private_key, |
+ log => "access_log_$domain", |
mathias
2018/03/27 14:46:51
I don't know who started this practice but I don't
f.lopez
2018/03/27 19:29:49
Acknowledged.
|
+ }) |
+ |
+ ensure_resource('adblockplus::user', $deploy_user, { |
+ authorized_keys => $deploy_user_authorized_keys, |
+ ensure => $ensure, |
+ password_hash => '*', |
+ shell => '/bin/bash', |
+ groups => ['www-data'], |
+ }) |
+ |
+ # https://docs.puppet.com/puppet/latest/function.html#createresources |
+ create_resources('adblockplus::web::static::hook', $hooks) |
+} |
+ |