Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: modules/adblockplus/manifests/web/static.pp

Issue 29733731: #7320 - Introduce helpcenter role (Closed)
Patch Set: For comments 2 to 4 Created April 2, 2018, 10:36 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(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 #
mathias 2018/04/05 01:12:30 There's one empty line too many here.
f.lopez 2018/04/10 02:45:39 Acknowledged.
7 #
8 # === Parameters:
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 # [*deploy_user*]
25 # User that will be used to issue commands.
26 #
27 # [*deploy_user_authorized_keys*]
28 # Array of public keys that will have access to ssh commands
29 #
30 # [*hooks*]
31 # Hash of adblockplus::web::static::hook items to set up in this context.
32 #
33 # === Examples:
34 #
35 # class {'adblockplus::web::static':
36 # domain => 'help.eyeo.com',
37 # hooks => {
38 # own-uname => {
39 # file => {
40 # content => 'uname -a',
41 # }
42 # }
43 # },
44 # }
45 #
46 class adblockplus::web::static (
47 $domain,
48 $ssl_certificate = undef,
49 $ssl_private_key = undef,
50 $ensure = 'present',
51 $deploy_user = 'web-deploy',
52 $deploy_user_authorized_keys = undef,
mathias 2018/04/05 01:12:30 This should default to an empty list.
f.lopez 2018/04/10 02:45:39 Acknowledged.
53 $hooks = {},
54 ) {
55
56 include adblockplus::web
57 include nginx
58 include geoip
59 include ssh
60
61 File {
62 mode => '0755',
63 owner => $deploy_user,
64 group => $deploy_user,
65 }
66
67 ensure_resource('file', "/var/www/$domain", {
68 ensure => ensure_directory_state($ensure),
69 owner => www-data,
mathias 2018/04/05 01:12:29 Please quote non-keyword strings, always.
f.lopez 2018/04/10 02:45:38 Acknowledged.
70 group => www-data,
71 })
72
73 ensure_resource('nginx::hostconfig', $title, {
74 content => template('adblockplus/web/static.conf.erb'),
75 certificate => $ssl_certificate,
76 domain => $domain,
77 is_default => 'true',
mathias 2018/04/05 01:12:29 This keywords should not need quotes.
f.lopez 2018/04/10 02:45:38 Acknowledged.
78 private_key => $ssl_private_key,
79 log => "web.access.log",
mathias 2018/04/05 01:12:28 This should be single quotes. (I would prefer stic
f.lopez 2018/04/10 02:45:39 Acknowledged.
80 })
81
82 $content = [
83 "Match User ${deploy_user}",
84 'AllowTcpForwarding no',
85 'X11Forwarding no',
86 'AllowAgentForwarding no',
87 'GatewayPorts no',
88 'ForceCommand /usr/local/bin/hooks_wrapper',
89 ]
90
91 create_resources('concat::fragment', {
mathias 2018/04/05 01:12:28 There's no need to use the create_resources() func
f.lopez 2018/04/10 02:45:38 Acknowledged.
92 helpcenter => {
93 content => join($content, "\n"),
mathias 2018/04/05 01:12:28 If you'd use "\n\t" or similar it would create a m
f.lopez 2018/04/10 02:45:38 Acknowledged.
94 ensure => 'present',
95 target => 'sshd_config',
96 order => '20',
97 }})
98
99 ensure_resource('adblockplus::user', $deploy_user, {
100 authorized_keys => $deploy_user_authorized_keys,
101 ensure => $ensure,
102 password_hash => '*',
mathias 2018/04/05 01:12:28 Is this parameter necessary? The underlying named
f.lopez 2018/04/10 02:45:39 Acknowledged.
103 shell => '/bin/bash',
104 groups => ['www-data'],
105 })
106
107 ensure_resource('file', "/usr/local/bin/hooks_wrapper", {
mathias 2018/04/05 01:12:28 Double quotes again :)
f.lopez 2018/04/10 02:45:38 Acknowledged.
108 ensure => ensure_file_state($ensure),
109 content => template('adblockplus/web/hooks_wrapper.sh.erb'),
110 })
111
112 ensure_resource('file', "/home/$deploy_user/bin", {
mathias 2018/04/05 01:12:30 And again :)
f.lopez 2018/04/10 02:45:38 this one has $deploy_user parameter in the middle,
113 ensure => ensure_directory_state($ensure),
114 })
115
116 # https://docs.puppet.com/puppet/latest/function.html#createresources
117 create_resources('adblockplus::web::static::hook', $hooks)
118 }
119
OLDNEW

Powered by Google App Engine
This is Rietveld