OLD | NEW |
(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 include adblockplus |
| 27 |
| 28 ensure_packages(['python3']) |
| 29 |
| 30 realize(File['/var/adblockplus']) |
| 31 |
| 32 file {'/var/adblockplus/mimeo': |
| 33 ensure => 'directory', |
| 34 mode => '0755', |
| 35 owner => 'root', |
| 36 require => File['/var/adblockplus'], |
| 37 } |
| 38 |
| 39 file {'/usr/local/bin/mimeo.py': |
| 40 ensure => 'present', |
| 41 owner => 'root', |
| 42 group => 'root', |
| 43 mode => 0755, |
| 44 source => 'puppet:///modules/adblockplus/mimeo.py', |
| 45 require => Package['python3'], |
| 46 } |
| 47 |
| 48 file {'/etc/systemd/system/mimeo.service': |
| 49 ensure => 'present', |
| 50 owner => 'root', |
| 51 group => 'root', |
| 52 mode => 0644, |
| 53 content => template('adblockplus/mimeo.service.erb'), |
| 54 require => File['/usr/local/bin/mimeo.py'], |
| 55 } |
| 56 |
| 57 Exec{ |
| 58 path => ['/usr/bin', '/bin'], |
| 59 } |
| 60 |
| 61 exec {'enable-service-mimeo': |
| 62 command => 'systemctl enable mimeo.service', |
| 63 user => 'root', |
| 64 unless => 'systemctl is-enabled mimeo.service', |
| 65 require => File['/etc/systemd/system/mimeo.service'], |
| 66 } |
| 67 |
| 68 service {'mimeo': |
| 69 ensure => 'running', |
| 70 hasrestart => false, |
| 71 provider => 'systemd', |
| 72 require => [ |
| 73 Exec['enable-service-mimeo'], |
| 74 File['/var/adblockplus/mimeo'], |
| 75 ], |
| 76 subscribe => File['/usr/local/bin/mimeo.py'], |
| 77 } |
| 78 |
| 79 exec {'reload-mimeo-daemon': |
| 80 notify => Service['mimeo'], |
| 81 command => 'systemctl daemon-reload', |
| 82 subscribe => File['/etc/systemd/system/mimeo.service'], |
| 83 refreshonly => true, |
| 84 } |
| 85 } |
| 86 |
OLD | NEW |