Index: modules/adblockplus/manifests/web/fileserver.pp |
=================================================================== |
new file mode 100644 |
--- /dev/null |
+++ b/modules/adblockplus/manifests/web/fileserver.pp |
@@ -0,0 +1,66 @@ |
+# == Class: adblockplus::web::fileserver |
+# |
+# Serves files for different repositories over https. |
+# |
+# === Parameters: |
+# |
+# [*domain*] |
+# A string for the domain serving traffic. |
mathias
2017/09/22 07:00:14
Why would the domain want to have some string? And
f.nicolaisen
2017/09/22 07:57:44
Acknowledged.
|
+# |
+# [*certificate*] |
+# The name of the SSL certificate file within modules/private/files, if any. |
+# Requires a private_key as well. |
+# |
+# [*private_key*] |
+# The name of the private key file within modules/private/files, if any. |
+# Requires a certificate as well. |
+# |
+# [*is_default*] |
mathias
2017/09/22 07:00:14
The fileserver is a standalone HTTPd setup intende
f.nicolaisen
2017/09/22 07:57:44
Acknowledged.
|
+# Passed on to nginx (whether or not the site config should be default). |
+# |
+# [*repository*] |
mathias
2017/09/22 07:00:14
The documentation of the $repository parameter doe
f.nicolaisen
2017/09/22 07:57:43
Acknowledged.
|
+# A string that is the name of the repository to serve. A repository |
+# is a collection of files uploaded by a group of users. |
+# |
+# TODO Convert this into a collection of *repositories* |
+# |
+class adblockplus::web::fileserver( |
+ $domain, |
+ $certificate, |
mathias
2017/09/22 07:00:14
Both $certificate and $private_key should default
f.nicolaisen
2017/09/22 07:57:43
Acknowledged.
|
+ $private_key, |
+ $is_default=false, |
+ $repositories={}, |
+){ |
+ |
+ include nginx |
+ include adblockplus |
+ include adblockplus::web |
+ |
+ nginx::hostconfig{$domain: |
+ source => 'puppet:///modules/adblockplus/nginx/fileserver.conf', |
+ is_default => $is_default, |
+ certificate => $certificate, |
+ private_key => $private_key, |
+ log => 'access_log_files' |
+ } |
+ |
+ # Root directory for serving repositories |
+ realize(File[$adblockplus::directory]) |
+ |
+ |
+ file {[ |
+ "$adblockplus::directory/fileserver", |
+ "$adblockplus::directory/fileserver/repositories" |
+ ]: |
+ ensure => directory, |
+ } |
+ |
+ |
+ if !empty($repositories) { |
mathias
2017/09/22 07:00:14
This conditional is not necessary: Iterating throu
f.nicolaisen
2017/09/22 07:57:44
Acknowledged.
|
+ ensure_resources('repository', $repositories, { |
mathias
2017/09/22 07:00:14
Please use the fully qualified name here, e.g. adb
f.nicolaisen
2017/09/22 07:57:43
Acknowledged.
|
+ ensure => 'present', |
+ }) |
+ } |
+ |
+} |
+ |