Forge Home

geolocation

Facter facts based on the output from freegeoip.net

9,811 downloads

9,429 latest version

4.0 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 0.0.3 (latest)
  • 0.0.2
  • 0.0.1
released Nov 8th 2014

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'ripienaar-geolocation', '0.0.3'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add ripienaar-geolocation
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install ripienaar-geolocation --version 0.0.3

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

ripienaar/geolocation — version 0.0.3 Nov 8th 2014

What?

A custom fact that queries http://freegeoip.net/ for the machines location

geo_area_code => unknown
geo_city => Amsterdam
geo_country_code => NL
geo_country_name => Netherlands
geo_latitude => 52.35
geo_longitude => 4.9167
geo_metro_code => unknown
geo_region_code => 07
geo_region_name => Noord-Holland
geo_zipcode => unknown

freegeoip.net will return a lot of information when available, but as you can see above when some part is not available we show unknown

Status?

Since this fact queries a remote service you probably do not want to install it on sensitive machines, or 1000s of machines at a time.

You could consider hosting your own instance of the app though, the source is @ https://github.com/fiorix/freegeoip

The fact writes a cache into your OS temp directory and if the file exist on a future run it will just read that and not query the Remote API. On my machine that is /tmp/freegeoip_facter.pstore.

Facter does not really have a way for facts to have configuration so the url for the freegeoip service is hard coded and the tempdir is whatever your system sets via ruby's tempdir module. So ths will work on windows or unix and honor things like TMPDIR environment variables.

Contact?

R.I.Pienaar / rip@devco.net / @ripienaar / http://devco.net