| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # == Type: adblockplus::web::fileserver::repository | |
| 2 # | |
| 3 # Manage a repository in a filterserver. | |
| 4 # | |
| 5 # A repository is a directory where a group of people can place files. | |
| 6 # The directory is linked into /var/www so that the files can be downloaded. | |
| 7 # | |
| 8 # The directory and the group have the same name. | |
| 9 # | |
| 10 # === parameters: | |
| 11 # | |
| 12 # [*ensure*] | |
| 13 # Whether to set up the repository or not. Removing repositories is not suppor ted. | |
| 14 # | |
| 15 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', | |
| 17 ){ | |
| 18 | |
| 19 $repositories_directory = "$adblockplus::directory/fileserver/repositories" | |
| 20 | |
| 21 if $ensure !~ /^(absent|purged)$/ { | |
| 22 group {"www-$name": | |
| 23 ensure => present, | |
| 24 # TODO Members are handled manually on the target server for now. Should g o into configuration. | |
| 25 } | |
| 26 | |
| 27 # (2) create the repository folder | |
| 28 file {"$repositories_directory/$name": | |
| 29 ensure => directory, | |
| 30 group => "www-$name", | |
| 31 mode => '0775', | |
| 32 require => [ | |
| 33 File["$repositories_directory"], | |
| 34 Group["www-$name"], | |
| 35 ], | |
| 36 } | |
| 37 | |
| 38 # (3) symlink the repository into www: | |
| 39 file {"/var/www/$name": | |
| 40 ensure => link, | |
| 41 target => "$repositories_directory/$name", | |
| 42 require => [ | |
| 43 File["$repositories_directory/$name"], | |
| 44 Package['nginx'], | |
| 45 ], | |
| 46 } | |
| 47 } | |
| 48 } | |
| OLD | NEW |