Left: | ||
Right: |
OLD | NEW |
---|---|
(Empty) | |
1 # == Class: adblockplus::web::static | |
2 # | |
3 # Manage a simple Nginx-based webserver for static content | |
4 # that uses a customizable deployment script to e.g. fetch the content | |
5 # from a repository server (ref. http://hub.eyeo.com/issues/4523) | |
6 # | |
7 # | |
8 # === Parameters: | |
mathias
2018/03/27 14:46:51
Incomplete.
f.lopez
2018/03/27 19:29:50
Acknowledged.
| |
9 # | |
10 # [*domain*] | |
11 # The domain name for the website. | |
12 # | |
13 # [*ssl_certificate*] | |
14 # The name of the SSL certificate file within modules/private/files, if any. | |
15 # Requires a private_key as well. | |
16 # | |
17 # [*ssl_private_key*] | |
18 # The name of the private key file within modules/private/files, if any. | |
19 # Requires a certificate as well. | |
20 # | |
21 # [*ensure*] | |
22 # Whether to set up the website or not. | |
23 # | |
24 # [*hooks*] | |
25 # Hash of adblockplus::web::static::hook items to set up in this context. | |
26 # | |
27 # === Examples: | |
28 # | |
29 # class {'adblockplus::web::static': | |
30 # domain => 'help.eyeo.com', | |
31 # hooks => { | |
32 # deploy => { | |
33 # file => { | |
34 # content => 'uname -a', | |
mathias
2018/03/27 14:46:51
That is a quite strange "deploy" example.
f.lopez
2018/03/27 19:29:50
heh :), I'll change the name of the example :D
| |
35 # } | |
36 # } | |
37 # }, | |
38 # } | |
39 # | |
40 class adblockplus::web::static ( | |
41 $domain = undef, | |
mathias
2018/03/27 14:46:50
A required parameter shall not default to anything
f.lopez
2018/03/27 19:29:50
Acknowledged.
| |
42 $ssl_certificate = undef, | |
43 $ssl_private_key = undef, | |
44 $ensure = 'present', | |
45 $deploy_user = 'web-deploy', | |
46 $deploy_user_authorized_keys = undef, | |
47 $hooks = {}, | |
48 ) { | |
49 | |
50 include adblockplus::web | |
51 include nginx | |
52 include geoip | |
53 include ssh | |
54 | |
55 ensure_resource('file', "/var/www/$domain", { | |
56 ensure => ensure_directory_state($ensure), | |
57 mode => '0775', | |
58 owner => www-data, | |
59 group => www-data, | |
60 }) | |
61 | |
62 ensure_resource('nginx::hostconfig', $title, { | |
63 content => template('adblockplus/web/static.conf.erb'), | |
64 certificate => $ssl_certificate, | |
65 domain => $domain, | |
66 is_default => $is_default, | |
mathias
2018/03/27 14:46:50
is_undef
f.lopez
2018/03/27 19:29:49
Acknowledged.
| |
67 private_key => $ssl_private_key, | |
68 log => "access_log_$domain", | |
mathias
2018/03/27 14:46:51
I don't know who started this practice but I don't
f.lopez
2018/03/27 19:29:49
Acknowledged.
| |
69 }) | |
70 | |
71 ensure_resource('adblockplus::user', $deploy_user, { | |
72 authorized_keys => $deploy_user_authorized_keys, | |
73 ensure => $ensure, | |
74 password_hash => '*', | |
75 shell => '/bin/bash', | |
76 groups => ['www-data'], | |
77 }) | |
78 | |
79 # https://docs.puppet.com/puppet/latest/function.html#createresources | |
80 create_resources('adblockplus::web::static::hook', $hooks) | |
81 } | |
82 | |
OLD | NEW |