Puppet Class: puppetmaster::geoip

Defined in:
modules/puppetmaster/manifests/geoip.pp

Overview

Parameters:

  • fetch_private (Any) (defaults to: true)
  • use_proxy (Any) (defaults to: true)


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'modules/puppetmaster/manifests/geoip.pp', line 1

class puppetmaster::geoip(
    $fetch_private = true,
    $use_proxy = true,
) {
    # Fetch the GeoIP databases into puppet's volatile dir, so that other hosts
    # can then just sync that directory into their own /usr/share/GeoIP via a
    # normal puppet File resource (see the geoip module for more)

    $geoip_destdir = "${puppetmaster::volatiledir}/GeoIP"

    # geoip::data classes depend on this
    file { $geoip_destdir:
        ensure => directory,
    }

    if $use_proxy {
        $webproxy = "http://webproxy.${::site}.wmnet:8080"
    } else {
        $webproxy = undef
    }

    if $fetch_private {
        # Fetch the proprietary paid-for MaxMind database
        include ::passwords::geoip

        class { '::geoip::data::maxmind':
            data_directory => $geoip_destdir,
            proxy          => $webproxy,
            user_id        => $passwords::geoip::user_id,
            license_key    => $passwords::geoip::license_key,
            product_ids    => [
                '106', # GeoIP.dat
                '115', # GeoIPRegion.dat
                '132', # GeoIPCity.dat
                '133', # GeoIPCity.dat
                '171', # GeoIPNetSpeed.dat
                '177', # GeoIPNetSpeedCell.dat
                'GeoIP2-City',
                'GeoIP2-Connection-Type',
                'GeoIP2-Country',
                'GeoIP2-ISP',
                ],
        }
    } else {
        class { '::geoip::data::maxmind':
            data_directory => $geoip_destdir,
            proxy          => $webproxy,
            product_ids    => [
                '506', # GeoLite Legacy Country
                '517', # GeoLite ASN
                '533', # GeoLite Legacy City
                'GeoLite2-Country',
                'GeoLite2-City',
                ],
        }

        # compatibility symlinks, so that users can use the stable paths
        # GeoIP.dat/GeoIPCity.dat between labs and production
        file { "${geoip_destdir}/GeoIP.dat":
            ensure => link,
            target => 'GeoLiteCountry.dat',
        }
        file { "${geoip_destdir}/GeoIPCity.dat":
            ensure => link,
            target => 'GeoLiteCity.dat',
        }
        file { "${geoip_destdir}/GeoIP2-Country.mmdb":
            ensure => link,
            target => 'GeoLite2-Country.mmdb',
        }
        file { "${geoip_destdir}/GeoIP2-City.mmdb":
            ensure => link,
            target => 'GeoLite2-City.mmdb',
        }
    }
}