Index: modules/adblockplus/manifests/web/fileserver/repository.pp |
=================================================================== |
new file mode 100644 |
--- /dev/null |
+++ b/modules/adblockplus/manifests/web/fileserver/repository.pp |
@@ -0,0 +1,48 @@ |
+# == Type: adblockplus::web::fileserver::repository |
+# |
+# Manage a repository in a filterserver. |
+# |
+# A repository is a directory where a group of people can place files. |
+# The directory is linked into /var/www so that the files can be downloaded. |
+# |
+# The directory and the group have the same name. |
+# |
+# === parameters: |
+# |
+# [*ensure*] |
+# Whether to set up the repository or not. Removing repositories is not supported. |
+# |
+define adblockplus::web::fileserver::repository ( |
mathias
2017/09/22 07:00:15
Why ::repository? This is rather misleading. Or do
f.nicolaisen
2017/09/22 07:57:44
Since I don't know where this is going to end up,
|
+ $ensure = 'present', |
+){ |
+ |
+ $repositories_directory = "$adblockplus::directory/fileserver/repositories" |
+ |
+ if $ensure !~ /^(absent|purged)$/ { |
+ group {"www-$name": |
+ ensure => present, |
+ # TODO Members are handled manually on the target server for now. Should go into configuration. |
+ } |
+ |
+ # (2) create the repository folder |
+ file {"$repositories_directory/$name": |
+ ensure => directory, |
+ group => "www-$name", |
+ mode => '0775', |
+ require => [ |
+ File["$repositories_directory"], |
+ Group["www-$name"], |
+ ], |
+ } |
+ |
+ # (3) symlink the repository into www: |
+ file {"/var/www/$name": |
+ ensure => link, |
+ target => "$repositories_directory/$name", |
+ require => [ |
+ File["$repositories_directory/$name"], |
+ Package['nginx'], |
+ ], |
+ } |
+ } |
+} |