| Left: | ||
| Right: | 
| LEFT | RIGHT | 
|---|---|
| 1 # == Class: adblockplus::web::fileserver | 1 # == Class: adblockplus::web::fileserver | 
| 2 # | 2 # | 
| 3 # A fileserver serves multiple file repositories. | 3 # A fileserver serves multiple file repositories. | 
| 4 # | 4 # | 
| 5 # === Parameters: | 5 # === Parameters: | 
| 6 # | 6 # | 
| 7 # [*domain*] | 7 # [*domain*] | 
| 8 # A string which is the name of the fileserver domain, under which | 8 # A string which is the name of the fileserver domain, under which | 
| 9 # each repository has a subdomain. | 9 # each repository has a subdomain. | 
| 10 # | 10 # | 
| 11 # [*certificate*] | 11 # [*certificate*] | 
| 12 # The name of the SSL certificate file within modules/private/files, if any. | 12 # The name of the SSL certificate file within modules/private/files, if any. | 
| 13 # Requires a private_key as well. | 13 # Requires a private_key as well. | 
| 14 # | 14 # | 
| 15 # [*private_key*] | 15 # [*private_key*] | 
| 16 # The name of the private key file within modules/private/files, if any. | 16 # The name of the private key file within modules/private/files, if any. | 
| 17 # Requires a certificate as well. | 17 # Requires a certificate as well. | 
| 18 # | 18 # | 
| 19 # [*is_default*] | 19 # [*is_default*] | 
| 20 # Passed on to nginx (whether or not the site config should be default). | 20 # Passed on to nginx (whether or not the site config should be default). | 
| 21 # | 21 # | 
| 22 # [*repositories*] | 22 # [*repositories*] | 
| 23 # A collection (hash) of repositories to serve. | 23 # A collection (hash) of repositories to serve. | 
| 24 # The contents of a repository is served on a subdomain of the fileserver. | 24 # The contents of a repository is served on a subdomain of the fileserver. | 
| 25 # | 25 # | 
| 26 class adblockplus::web::fileserver( | 26 class adblockplus::web::fileserver( | 
| 27 $ensure = 'present', | |
| 27 $domain, | 28 $domain, | 
| 28 $certificate = undef, | 29 $certificate = undef, | 
| 29 $private_key = undef, | 30 $private_key = undef, | 
| 30 $repositories={}, | 31 $repositories={}, | 
| 31 ){ | 32 ){ | 
| 32 | 33 | 
| 33 include nginx | 34 include nginx | 
| 34 include adblockplus | 35 include adblockplus | 
| 35 include adblockplus::web | 36 include adblockplus::web | 
| 36 | 37 | 
| 37 # Root directory for serving repositories | |
| 38 realize(File[$adblockplus::directory]) | 38 realize(File[$adblockplus::directory]) | 
| 39 | 39 | 
| 40 file {[ | 40 file {"$adblockplus::directory/fileserver": | 
| 41 "$adblockplus::directory/fileserver", | |
| 42 "$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.
 
 | |
| 43 ]: | |
| 44 ensure => directory, | 41 ensure => directory, | 
| 45 } | 42 } | 
| 46 | 43 | 
| 47 ensure_resources('adblockplus::web::fileserver::repository', $repositories, { | 44 ensure_resources('adblockplus::web::fileserver::repository', $repositories, { | 
| 48 ensure => 'present', | 45 ensure => 'present', | 
| 49 }) | 46 }) | 
| 50 | 47 | 
| 51 nginx::hostconfig{ "$domain": | 48 nginx::hostconfig{ "$domain": | 
| 52 source => 'puppet:///modules/adblockplus/nginx/fileserver.conf', | 49 source => 'puppet:///modules/adblockplus/nginx/fileserver.conf', | 
| 53 is_default => true, | 50 is_default => true, | 
| 54 certificate => $certificate, | 51 certificate => $certificate, | 
| 55 private_key => $private_key, | 52 private_key => $private_key, | 
| 56 log => "access_log_fileserver_repository", | 53 log => 'access_log_fileserver', | 
| 
 
mathias
2017/09/25 17:06:04
Why not just `access_log_fileserver`?
 
f.nicolaisen
2017/09/25 20:21:18
Acknowledged.
 
 | |
| 57 } | 54 } | 
| 58 } | 55 } | 
| 59 | 56 | 
| LEFT | RIGHT |