LEFT | RIGHT |
1 # == Type: adblockplus::web::fileserver::repository | 1 # == Type: adblockplus::web::fileserver::repository |
2 # | 2 # |
3 # Manage a repository on a fileserver. | 3 # Manage a repository on a fileserver. |
4 # | 4 # |
5 # A repository is a site where a group of people can upload and artifacts. | 5 # A repository is a site where a group of people can upload and artifacts. |
6 # | 6 # |
7 # In its current form, a repository is simply a directory exposed on a web | 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 | 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 # future (proxy to repository manager, or 3rd-party service, etc). |
10 # | 10 # |
11 # === parameters: | 11 # === parameters: |
12 # | 12 # |
13 # [*ensure*] | 13 # [*ensure*] |
14 # Whether to set up the repository or not. Removing repositories is not | 14 # Whether to set up the repository or not. Removing repositories is not |
15 # supported. | 15 # supported. |
16 # | 16 # |
17 # [*users*] | 17 # [*users*] |
18 # System users that should be created and added to the group that has | 18 # System users that should be created and added to the group that has |
19 # write permissions for the repository directory | 19 # write permissions for the repository directory |
20 # | 20 # |
21 define adblockplus::web::fileserver::repository ( | 21 define adblockplus::web::fileserver::repository ( |
22 $ensure = 'present', | 22 $ensure = 'present', |
23 $users = {}, | 23 $users = {}, |
24 ){ | 24 ){ |
25 | 25 |
26 $repositories_directory = "$adblockplus::directory/fileserver" | 26 $repositories_directory = "$adblockplus::directory/fileserver" |
27 $repository_directory = "$repositories_directory/$name" | 27 $repository_directory = "$repositories_directory/$name" |
| 28 $group_name = "www-$name" |
28 $repository_host = $name ? { | 29 $repository_host = $name ? { |
29 'root' => "$adblockplus::web::fileserver::domain", | 30 'www' => "$adblockplus::web::fileserver::domain", |
30 default => "$name.$adblockplus::web::fileserver::domain", | 31 default => "$name.$adblockplus::web::fileserver::domain", |
31 } | |
32 $group_name = $name ? { | |
33 'root' => 'www', | |
34 default => "www-$name", | |
35 } | 32 } |
36 | 33 |
37 group {"$group_name": | 34 group {"$group_name": |
38 ensure => $ensure, | 35 ensure => $ensure, |
39 } | 36 } |
40 | 37 |
41 file {"$repository_directory": | 38 file {"$repository_directory": |
42 ensure => ensure_directory_state($ensure), | 39 ensure => ensure_directory_state($ensure), |
43 group => $group_name, | 40 group => $group_name, |
44 mode => '0775', | 41 mode => '0775', |
(...skipping 11 matching lines...) Expand all Loading... |
56 | 53 |
57 realize(File[$adblockplus::directory]) | 54 realize(File[$adblockplus::directory]) |
58 | 55 |
59 file {"/var/www/$repository_host": | 56 file {"/var/www/$repository_host": |
60 ensure => ensure_symlink_state($ensure), | 57 ensure => ensure_symlink_state($ensure), |
61 target => "$repository_directory", | 58 target => "$repository_directory", |
62 require => File["$repository_directory"], | 59 require => File["$repository_directory"], |
63 } | 60 } |
64 } | 61 } |
65 | 62 |
LEFT | RIGHT |