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

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

Issue 29504594: #2687 - Include mimeo python module (Closed)
Patch Set: For comment 41 Created Aug. 21, 2017, 7:54 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::mimeo
2 #
3 # Class adblockplus::web::mimeo registers the information received in a
4 # http/s petition with an specified format in an specific output.
5 #
6 # === Parameters:
7 #
8 # [*format*]
9 # A string containing the desired format for logging.
10 #
11 # '$remote_addr - - [$time_local] "$request" $status $bytes_sent "$http_refere r"'
12 #
13 # [*port*]
14 # An integer to setup the port where the script will be listening, defaults
15 # to 8000.
16 #
17 # [*response*]
18 # A string (like format parameter) representing the response sent to the
19 # client.
20 #
21 class adblockplus::web::mimeo (
22 $format = '',
23 $port = 8000,
24 $response = '',
25 ){
26
27 ensure_packages(['python3'])
28
29 realize(File['/var/adblockplus'])
mathias 2017/08/21 20:07:38 Please explicitly include `adblockplus` when you r
f.lopez 2017/08/22 16:52:43 Done.
30
31 file {'/var/adblockplus/mimeo':
32 ensure => 'directory',
33 mode => '0755',
34 owner => 'root',
35 require => File['/var/adblockplus'],
36 }
37
38 file {'/usr/local/bin/mimeo.py':
39 ensure => 'present',
40 owner => 'root',
41 group => 'root',
42 mode => 0755,
43 source => 'puppet:///modules/adblockplus/mimeo.py',
44 require => [
45 Package['python3'],
46 File['/var/adblockplus/mimeo'],
mathias 2017/08/21 20:07:38 The script does not depend on the path hard-coded
f.lopez 2017/08/22 16:52:43 Yeah, you are right, I wasn't sure about this tbh.
47 ],
48 }
49
50 file {'/etc/systemd/system/mimeo.service':
51 ensure => 'present',
52 owner => 'root',
53 group => 'root',
54 mode => 0644,
55 content => template('adblockplus/mimeo.service.erb'),
56 require => File['/usr/local/bin/mimeo.py'],
57 }
58
59 Exec{
60 path => ['/usr/bin', '/bin'],
61 }
62
63 exec {'enable-service-mimeo':
64 command => 'systemctl enable mimeo.service',
65 user => 'root',
66 unless => 'systemctl is-enabled mimeo.service',
67 require => File['/etc/systemd/system/mimeo.service'],
68 }
69
70 service {'mimeo':
71 ensure => 'running',
72 hasrestart => false,
73 provider => 'systemd',
74 require => Exec['enable-service-mimeo'],
75 subscribe => File['/usr/local/bin/mimeo.py'],
76 }
77
78 exec {'reload-mimeo-daemon':
79 notify => Service['mimeo'],
80 command => 'systemctl daemon-reload',
81 subscribe => File['/etc/systemd/system/mimeo.service'],
82 refreshonly => true,
83 }
84 }
85
OLDNEW

Powered by Google App Engine
This is Rietveld