Left: | ||
Right: |
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 # TODO Members are handled manually on the target server for now. | 17 # Members are handled manually on the target server for now. |
18 # Figure out how to provision them. | 18 # Figure out how to provision them some day. |
19 # | 19 # |
20 define adblockplus::web::fileserver::repository ( | 20 define adblockplus::web::fileserver::repository ( |
21 $ensure = 'present', | 21 $ensure = 'present', |
22 ){ | 22 ){ |
23 | 23 |
24 $repositories_directory = "$adblockplus::directory/fileserver/repositories" | 24 $repositories_directory = "$adblockplus::directory/fileserver" |
25 $repository_directory = "$repositories_directory/$name" | 25 $repository_directory = "$repositories_directory/$name" |
26 $repository_host = "$name.$adblockplus::web::fileserver::domain" | 26 $repository_host = "$name.$adblockplus::web::fileserver::domain" |
27 | 27 |
28 if $ensure !~ /^(absent|purged)$/ { | 28 group {"www-$name": |
mathias
2017/09/25 17:06:04
Can't you avoid the conditional and base parameter
f.nicolaisen
2017/09/25 20:21:18
I can try!
| |
29 group {"www-$name": | 29 ensure => $ensure, |
30 ensure => present, | 30 } |
31 } | |
32 | 31 |
33 file {"$repository_directory": | 32 file {"$repository_directory": |
34 ensure => directory, | 33 ensure => ensure_directory_state($ensure), |
35 group => "www-$name", | 34 group => "www-$name", |
36 mode => '0775', | 35 mode => '0775', |
37 require => [ | 36 require => [ |
38 File["$repositories_directory"], | 37 File["$repositories_directory"], |
39 Group["www-$name"], | 38 Group["www-$name"], |
40 ], | 39 ], |
41 } | 40 } |
42 | 41 |
43 realize(File[$adblockplus::directory]) | 42 realize(File[$adblockplus::directory]) |
44 | 43 |
45 # TODO Figure out how to use $adblockplus::web::directory insetad of hardcod ed path | 44 file {"/var/www/$repository_host": |
mathias
2017/09/25 17:06:04
?
f.nicolaisen
2017/09/25 20:21:18
I discussed this with Paco, and he said it would n
mathias
2017/09/25 21:08:50
The '/var/www' path is not configurable for that d
f.nicolaisen
2017/09/25 21:19:47
Acknowledged.
| |
46 #file {"$adblockplus::web::directory/$name": | 45 ensure => ensure_symlink_state($ensure), |
47 file {"/var/www/$repository_host": | 46 target => "$repository_directory", |
48 ensure => link, | 47 require => File["$repository_directory"], |
49 target => "$repository_directory", | |
50 require => File["$repository_directory"], | |
51 } | |
52 } | 48 } |
53 } | 49 } |
54 | 50 |
LEFT | RIGHT |