Left: | ||
Right: |
OLD | NEW |
---|---|
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 # [*auth_file*] | |
22 # Overwrite the default options of the authentication file used for basic | |
23 # http authentication for nginx. | |
24 # | |
21 define adblockplus::web::fileserver::repository ( | 25 define adblockplus::web::fileserver::repository ( |
22 $ensure = 'present', | 26 $ensure = 'present', |
23 $users = {}, | 27 $users = {}, |
28 $auth_file = undef, | |
24 ){ | 29 ){ |
25 | 30 |
26 $repositories_directory = "$adblockplus::directory/fileserver" | 31 $repositories_directory = "$adblockplus::directory/fileserver" |
27 $repository_directory = "$repositories_directory/$name" | 32 $repository_directory = "$repositories_directory/$name" |
28 $group_name = "www-$name" | 33 $group_name = "www-$name" |
29 $repository_host = $name ? { | 34 $repository_host = $name ? { |
30 'www' => "$adblockplus::web::fileserver::domain", | 35 'www' => "$adblockplus::web::fileserver::domain", |
31 default => "$name.$adblockplus::web::fileserver::domain", | 36 default => "$name.$adblockplus::web::fileserver::domain", |
32 } | 37 } |
38 $auth_filename = "${::adblockplus::directory}/htpasswd/${name}" | |
39 | |
40 nginx::hostconfig {"$repository_host": | |
41 content => template("adblockplus/web/fileserver.conf.erb"), | |
42 is_default => false, | |
43 certificate => $adblockplus::web::fileserver::certificate, | |
44 private_key => $adblockplus::web::fileserver::private_key, | |
45 log => 'access_log_fileserver', | |
46 } | |
47 | |
48 ensure_resource('file', $auth_filename, merge({ | |
49 ensure => ensure_file_state($ensure), | |
50 }, $auth_file)) | |
mathias
2018/06/05 15:02:58
This might be undef now, to indicate that there's
f.lopez
2018/06/05 18:00:44
Acknowledged.
| |
33 | 51 |
34 group {"$group_name": | 52 group {"$group_name": |
35 ensure => $ensure, | 53 ensure => $ensure, |
36 } | 54 } |
37 | 55 |
38 file {"$repository_directory": | 56 file {"$repository_directory": |
39 ensure => ensure_directory_state($ensure), | 57 ensure => ensure_directory_state($ensure), |
40 group => $group_name, | 58 group => $group_name, |
41 mode => '0775', | 59 mode => '0775', |
42 require => [ | 60 require => [ |
(...skipping 10 matching lines...) Expand all Loading... | |
53 | 71 |
54 realize(File[$adblockplus::directory]) | 72 realize(File[$adblockplus::directory]) |
55 | 73 |
56 file {"/var/www/$repository_host": | 74 file {"/var/www/$repository_host": |
57 ensure => ensure_symlink_state($ensure), | 75 ensure => ensure_symlink_state($ensure), |
58 target => "$repository_directory", | 76 target => "$repository_directory", |
59 require => File["$repository_directory"], | 77 require => File["$repository_directory"], |
60 } | 78 } |
61 } | 79 } |
62 | 80 |
OLD | NEW |