| Left: | ||
| Right: | 
| LEFT | RIGHT | 
|---|---|
| 1 # == Type: adblockplus::web::fileserver::repository | 1 # == Type: adblockplus::web::fileserver::repository | 
| 2 # | 2 # | 
| 3 # Manage a repository in a filterserver. | 3 # Manage a repository on a fileserver. | 
| 4 # | 4 # | 
| 5 # A repository is a directory where a group of people can place files. | 5 # A repository is a site where a group of people can upload and artifacts. | 
| 6 # The directory is linked into /var/www so that the files can be downloaded. | |
| 7 # | 6 # | 
| 8 # The directory and the group have the same name. | 7 # In its current form, a repository is simply a directory exposed on a web | 
| 8 # server. This may evolve to make use of more advanced repositories in the | |
| 9 # future (proxy to repository manager, or 3rd-party service, etc). | |
| 9 # | 10 # | 
| 10 # === parameters: | 11 # === parameters: | 
| 11 # | 12 # | 
| 12 # [*ensure*] | 13 # [*ensure*] | 
| 13 # Whether to set up the repository or not. Removing repositories is not suppor ted. | 14 # Whether to set up the repository or not. Removing repositories is not | 
| 15 # supported. | |
| 16 # | |
| 17 # Members are handled manually on the target server for now. | |
| 18 # Figure out how to provision them some day. | |
| 14 # | 19 # | 
| 15 define adblockplus::web::fileserver::repository ( | 20 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,
 
 | |
| 16 $ensure = 'present', | 21 $ensure = 'present', | 
| 17 ){ | 22 ){ | 
| 18 | 23 | 
| 19 $repositories_directory = "$adblockplus::directory/fileserver/repositories" | 24 $repositories_directory = "$adblockplus::directory/fileserver" | 
| 25 $repository_directory = "$repositories_directory/$name" | |
| 26 $repository_host = "$name.$adblockplus::web::fileserver::domain" | |
| 20 | 27 | 
| 21 if $ensure !~ /^(absent|purged)$/ { | 28 group {"www-$name": | 
| 22 group {"www-$name": | 29 ensure => $ensure, | 
| 23 ensure => present, | 30 } | 
| 24 # TODO Members are handled manually on the target server for now. Should g o into configuration. | |
| 25 } | |
| 26 | 31 | 
| 27 # (2) create the repository folder | 32 file {"$repository_directory": | 
| 28 file {"$repositories_directory/$name": | 33 ensure => ensure_directory_state($ensure), | 
| 29 ensure => directory, | 34 group => "www-$name", | 
| 30 group => "www-$name", | 35 mode => '0775', | 
| 31 mode => '0775', | 36 require => [ | 
| 32 require => [ | 37 File["$repositories_directory"], | 
| 33 File["$repositories_directory"], | 38 Group["www-$name"], | 
| 34 Group["www-$name"], | 39 ], | 
| 35 ], | 40 } | 
| 36 } | |
| 37 | 41 | 
| 38 # (3) symlink the repository into www: | 42 realize(File[$adblockplus::directory]) | 
| 39 file {"/var/www/$name": | 43 | 
| 40 ensure => link, | 44 file {"/var/www/$repository_host": | 
| 41 target => "$repositories_directory/$name", | 45 ensure => ensure_symlink_state($ensure), | 
| 42 require => [ | 46 target => "$repository_directory", | 
| 43 File["$repositories_directory/$name"], | 47 require => File["$repository_directory"], | 
| 44 Package['nginx'], | |
| 45 ], | |
| 46 } | |
| 47 } | 48 } | 
| 48 } | 49 } | 
| 50 | |
| LEFT | RIGHT |