OLD | NEW |
(Empty) | |
| 1 # == Type: adblockplus::web::fileserver::repository |
| 2 # |
| 3 # Manage a repository on a fileserver. |
| 4 # |
| 5 # A repository is a site where a group of people can upload and artifacts. |
| 6 # |
| 7 # In its current form, a repository is simply a directory exposed on a web |
| 8 # server. |
| 9 # |
| 10 # The contents of a repository is served on a subdomain of the fileserver. |
| 11 # |
| 12 # === parameters: |
| 13 # |
| 14 # [*ensure*] |
| 15 # Whether to set up the repository or not. Removing repositories is not |
| 16 # supported. |
| 17 # |
| 18 # [*fileserver_domain*] |
| 19 # A string which is the name of the fileserver domain, under which |
| 20 # each repository has a subdomain. |
| 21 # |
| 22 # [*certificate*] |
| 23 # The name of the SSL certificate file within modules/private/files, if any. |
| 24 # Requires a private_key as well. |
| 25 # |
| 26 # [*fileserver_domain*] |
| 27 # A string which is the name of the fileserver domain, under which |
| 28 # each repository has a subdomain. |
| 29 # |
| 30 # TODO Figure out how to inherit and use the parent's class domain instead of |
| 31 # having to duplicate it here. |
| 32 # |
| 33 # [*members*] |
| 34 # An array of usernames that should have write access to the repository. |
| 35 # |
| 36 # TODO Members are handled manually on the target server for now. |
| 37 # Figure out how to provision them. |
| 38 # |
| 39 define adblockplus::web::fileserver::repository ( |
| 40 $ensure = 'present', |
| 41 $certificate = $::certificate, |
| 42 $private_key = $::private_key, |
| 43 $fileserver_domain = "$::fileserver_domain", |
| 44 $members = [], |
| 45 ){ |
| 46 |
| 47 $repositories_directory = "$adblockplus::directory/fileserver/repositories" |
| 48 $repository_domain = "$name.$fileserver_domain" |
| 49 $repository_directory = "$repositories_directory/$name" |
| 50 |
| 51 if $ensure !~ /^(absent|purged)$/ { |
| 52 group {"www-$name": |
| 53 ensure => present, |
| 54 } |
| 55 |
| 56 file {"$repositories_directory/$name": |
| 57 ensure => directory, |
| 58 group => "www-$name", |
| 59 mode => '0775', |
| 60 require => [ |
| 61 File["$repositories_directory"], |
| 62 Group["www-$name"], |
| 63 ], |
| 64 } |
| 65 |
| 66 realize(File[$adblockplus::directory]) |
| 67 |
| 68 # TODO Figure out how to use $adblockplus::web::directory insetad of hardcod
ed path |
| 69 file {"/var/www/$name": |
| 70 ensure => link, |
| 71 target => "$repositories_directory/$name", |
| 72 require => [ |
| 73 File["$repositories_directory/$name"], |
| 74 Package['nginx'], |
| 75 ], |
| 76 } |
| 77 |
| 78 nginx::hostconfig{ "$repository_domain": |
| 79 content => template('adblockplus/web/fileserver/repository.conf.erb'), |
| 80 is_default => $is_default, |
| 81 certificate => $certificate, |
| 82 private_key => $private_key, |
| 83 domain => $repository_domain, |
| 84 log => "access_log_fileserver_repository_$repository_domain", |
| 85 } |
| 86 } |
| 87 } |
OLD | NEW |