OLD | NEW |
1 # == Class: geoip | 1 # == Class: geoip |
2 # | 2 # |
3 # Manage GeoIP (http://dev.maxmind.com/geoip/) databases. | 3 # Manage GeoIP (http://dev.maxmind.com/geoip/) databases. |
4 # | 4 # |
5 # === Parameters: | 5 # === Parameters: |
6 # | 6 # |
7 # [*cron*] | 7 # [*cron*] |
8 # Default options for Cron['geoip'], e.g. $minute, $monthday etc. | 8 # Default options for Cron['geoip'], e.g. $minute, $monthday etc. |
9 # | 9 # |
10 # [*ensure*] | 10 # [*ensure*] |
(...skipping 16 matching lines...) Expand all Loading... |
27 # 'minute' => 0, | 27 # 'minute' => 0, |
28 # 'hour' => 8, | 28 # 'hour' => 8, |
29 # 'monthday' => 15, | 29 # 'monthday' => 15, |
30 # }, | 30 # }, |
31 # } | 31 # } |
32 # | 32 # |
33 class geoip ( | 33 class geoip ( |
34 $cron = {}, | 34 $cron = {}, |
35 $ensure = 'present', | 35 $ensure = 'present', |
36 $hook = undef, | 36 $hook = undef, |
37 $packages = ['geoip-database'], | 37 $packages = [ |
| 38 'geoip-database', |
| 39 'python-geoip', |
| 40 ], |
38 $script = '/usr/local/sbin/update-geoip-database', | 41 $script = '/usr/local/sbin/update-geoip-database', |
39 ) { | 42 ) { |
40 | 43 |
41 ensure_resource('package', $packages, { | 44 ensure_resource('package', $packages, { |
42 ensure => $ensure, | 45 ensure => $ensure, |
43 }) | 46 }) |
44 | 47 |
| 48 ensure_resource('package', 'python-geoip2', { |
| 49 ensure => $ensure, |
| 50 name => 'geoip2', |
| 51 provider => 'pip', |
| 52 require => Package['python-pip'], |
| 53 }) |
| 54 |
45 create_resources('cron', {geoip => $cron}, { | 55 create_resources('cron', {geoip => $cron}, { |
46 command => $hook ? {undef => $script, default => "$script && $hook"}, | 56 command => $hook ? {undef => $script, default => "$script && $hook"}, |
47 ensure => $ensure ? {/^(absent|purged)$/ => 'absent', default => 'present'}, | 57 ensure => $ensure ? {/^(absent|purged)$/ => 'absent', default => 'present'}, |
48 hour => 0, | 58 hour => 0, |
49 minute => 0, | 59 minute => 0, |
50 user => 'root', | 60 user => 'root', |
51 }) | 61 }) |
52 | 62 |
53 file {$script: | 63 file {$script: |
54 before => Cron['geoip'], | 64 before => Cron['geoip'], |
55 ensure => $ensure ? {/^(absent|purged)$/ => 'absent', default => 'present'}, | 65 ensure => $ensure ? {/^(absent|purged)$/ => 'absent', default => 'present'}, |
56 mode => 0755, | 66 mode => 0755, |
57 require => Package[$packages], | 67 require => Package[$packages], |
58 source => 'puppet:///modules/geoip/update.py', | 68 source => 'puppet:///modules/geoip/update.py', |
59 } | 69 } |
60 } | 70 } |
OLD | NEW |