jgeusebroek / ansible-role-maxmind-geoip Goto Github PK
View Code? Open in Web Editor NEWAn Ansible Role that installs and configures the Maxmind GeoIP databases
An Ansible Role that installs and configures the Maxmind GeoIP databases
$ ansible-galaxy install -r requirements.yml
Starting galaxy role install process
- downloading role 'maxmind_geoip', owned by jgeusebroek
[WARNING]: - jgeusebroek.maxmind_geoip was NOT installed successfully: - the specified version (v1.6) of jgeusebroek.maxmind_geoip was not
found in the list of available versions ([{'id': 59560, 'url': '', 'related': {}, 'summary_fields': {}, 'created':
'2018-05-08T10:03:45.636551Z', 'modified': '2018-06-23T19:05:29.300569Z', 'name': 'v1.4', 'version': None, 'commit_date':
'2018-05-08T04:38:06-04:00', 'commit_sha': None, 'download_url': 'https://github.com/jgeusebroek/ansible-role-maxmind-
geoip/archive/v1.4.tar.gz', 'active': None}]).
ERROR! - you can use --ignore-errors to skip failed roles and finish processing the list.
It appears that Ansible Galaxy only has v1.4, please publish newer versions.
The role successfully ended which is out of my expectation since the default id-key combination is invalid:
vagrant@default:~$ sudo /usr/bin/geoipupdate -f /etc/GeoIP.conf
error retrieving updates: error while getting database for GeoLite2-City: unexpected HTTP status code: received HTTP status code: 401: Your account ID or license key could not be authenticated.
vagrant@default:~$ echo $?
1
It turns out that the handler does not fail on rc==1
, while the fail condition should be rc!=0
instead
ansible-role-maxmind-geoip/handlers/main.yml
Lines 2 to 5 in b9e8798
I suggest failing the role if the key-id combination is invalid so that the role user can be notified that something is wrong, instead of wondering why the update didn't work, or at least displaying a warning message that the user has to fix the problem themselves.
The documentation of the maxmind_update_userid
and the maxmind_update_licensekey
variables also kinda implies that the id-key combination will work for the free databases, which it does not.
ansible-role-maxmind-geoip//README.md
Lines 33 to 35 in b9e8798
I suggest also fixing them to be consistent with the current state.
TASK [jgeusebroek.maxmind_geoip : Add Maxmind PPA repository | Ubuntu] *************************************************************
fatal: [geoip-update]: FAILED! => {"changed": false, "cmd": "apt-key export F44B38CE3DB1BF64B61DBD28DE1997DCDE742AFA", "msg": "E: gnupg, gnupg2 and gnupg1 do not seem to be installed, but one of them is required for this operation", "rc": 255, "stderr": "E: gnupg, gnupg2 and gnupg1 do not seem to be installed, but one of them is required for this operation\n", "stderr_lines": ["E: gnupg, gnupg2 and gnupg1 do not seem to be installed, but one of them is required for this operation"], "stdout": "", "stdout_lines": []}
It appears that the role itself doesn't install the package, which is rather done in the Ansible Molecule testing playbook(?):
ansible-role-maxmind-geoip/molecule/default/prepare.yml
Lines 5 to 11 in c5f7989
IMO the role should always satisfy whatever runtime dependencies it needed by installing appropriate packages, which means the package installation should happen in the role instead.
ansible-role-maxmind-geoip/tasks/configuration.yml
Lines 11 to 17 in b9e8798
As the file doesn't contain any sensitive information it should be 644 instead of 640 so that a sudoer can easily check the content without elevating privileges.
TASK [jgeusebroek.maxmind_geoip : Add Maxmind PPA repository | Ubuntu] **********************************************************************
fatal: [default]: FAILED! => {
"changed": false,
"cmd": "apt-key adv --recv-keys --no-tty --keyserver hkp://keyserver.ubuntu.com:80 F44B38CE3DB1BF64B61DBD28DE1997DCDE742AFA",
"rc": 1
}
STDOUT:
Executing: /tmp/apt-key-gpghome.X6HlupWgOJ/gpg.1.sh --recv-keys --no-tty --keyserver hkp://keyserver.ubuntu.com:80 F44B38CE3DB1BF64B61DBD28DE1997DCDE742AFA
STDERR:
Warning: apt-key output should not be parsed (stdout is not a terminal)
gpg: key DE1997DCDE742AFA: public key "Launchpad PPA for MaxMind" imported
gpg: Total number processed: 1
gpg: imported: 1
/usr/bin/apt-key: 402: cannot create /etc/apt/trusted.gpg: Permission denied
cat: /tmp/apt-key-gpghome.X6HlupWgOJ/gpgoutput.log: No such file or directory
One should not assume that the role consumers always set become: True
, consider specifying become: True
for all the tasks that require superuser privileges.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.