Index: modules/adblockplus/manifests/web/fileserver.pp |
=================================================================== |
new file mode 100644 |
--- /dev/null |
+++ b/modules/adblockplus/manifests/web/fileserver.pp |
@@ -0,0 +1,59 @@ |
+# == Class: adblockplus::web::fileserver |
+# |
+# A fileserver serves multiple file repositories. |
+# |
+# === Parameters: |
+# |
+# [*domain*] |
+# A string which is the name of the fileserver domain, under which |
+# each repository has a subdomain. |
+# |
+# [*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*] |
+# Passed on to nginx (whether or not the site config should be default). |
+# |
+# [*repositories*] |
+# A collection (hash) of repositories to serve. |
+# The contents of a repository is served on a subdomain of the fileserver. |
+# |
+class adblockplus::web::fileserver( |
+ $domain, |
+ $certificate = undef, |
+ $private_key = undef, |
+ $repositories={}, |
+){ |
+ |
+ include nginx |
+ include adblockplus |
+ include adblockplus::web |
+ |
+ # Root directory for serving repositories |
+ realize(File[$adblockplus::directory]) |
+ |
+ file {[ |
+ "$adblockplus::directory/fileserver", |
+ "$adblockplus::directory/fileserver/repositories" |
mathias
2017/09/25 17:06:03
I don't think the additional `repositories` direct
f.nicolaisen
2017/09/25 20:21:18
Acknowledged.
|
+ ]: |
+ ensure => directory, |
+ } |
+ |
+ ensure_resources('adblockplus::web::fileserver::repository', $repositories, { |
+ ensure => 'present', |
+ }) |
+ |
+ nginx::hostconfig{ "$domain": |
+ source => 'puppet:///modules/adblockplus/nginx/fileserver.conf', |
+ is_default => true, |
+ certificate => $certificate, |
+ private_key => $private_key, |
+ log => "access_log_fileserver_repository", |
mathias
2017/09/25 17:06:04
Why not just `access_log_fileserver`?
f.nicolaisen
2017/09/25 20:21:18
Acknowledged.
|
+ } |
+} |
+ |