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 # Members are handled manually on the target server for now. | 17 # [*users*] |
18 # Figure out how to provision them some day. | 18 # System users that should be created and added to the group that has |
19 # write permissions for the repository directory | |
19 # | 20 # |
20 define adblockplus::web::fileserver::repository ( | 21 define adblockplus::web::fileserver::repository ( |
21 $ensure = 'present', | 22 $ensure = 'present', |
23 $users = {}, | |
22 ){ | 24 ){ |
23 | 25 |
24 $repositories_directory = "$adblockplus::directory/fileserver" | 26 $repositories_directory = "$adblockplus::directory/fileserver" |
25 $repository_directory = "$repositories_directory/$name" | 27 $repository_directory = "$repositories_directory/$name" |
26 $repository_host = "$name.$adblockplus::web::fileserver::domain" | 28 $repository_host = "$name.$adblockplus::web::fileserver::domain" |
27 | 29 |
28 group {"www-$name": | 30 group {"www-$name": |
29 ensure => $ensure, | 31 ensure => $ensure, |
30 } | 32 } |
31 | 33 |
32 file {"$repository_directory": | 34 file {"$repository_directory": |
33 ensure => ensure_directory_state($ensure), | 35 ensure => ensure_directory_state($ensure), |
34 group => "www-$name", | 36 group => "www-$name", |
35 mode => '0775', | 37 mode => '0775', |
36 require => [ | 38 require => [ |
37 File["$repositories_directory"], | 39 File["$repositories_directory"], |
38 Group["www-$name"], | 40 Group["www-$name"], |
39 ], | 41 ], |
40 } | 42 } |
41 | 43 |
44 ensure_resources(adblockplus::user, $users, { | |
mathias
2018/03/05 15:28:35
Please use quotes (') around the type name.
Fred
2018/03/08 09:16:11
Acknowledged.
| |
45 ensure => $ensure, | |
46 password_hash => '*', | |
47 groups => ["www-$name"], | |
48 }) | |
49 | |
42 realize(File[$adblockplus::directory]) | 50 realize(File[$adblockplus::directory]) |
43 | 51 |
44 file {"/var/www/$repository_host": | 52 file {"/var/www/$repository_host": |
45 ensure => ensure_symlink_state($ensure), | 53 ensure => ensure_symlink_state($ensure), |
46 target => "$repository_directory", | 54 target => "$repository_directory", |
47 require => File["$repository_directory"], | 55 require => File["$repository_directory"], |
48 } | 56 } |
49 } | 57 } |
50 | 58 |
OLD | NEW |