Coder Social home page Coder Social logo

ansible-role-maxmind-geoip's People

Contributors

brlin-tw avatar cofenselabs-doug avatar jgeusebroek avatar tigattack avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ansible-role-maxmind-geoip's Issues

v1.6 not available in Ansible Galaxy

$ 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.

Handler task "Update GeoIP databases" should fail when using the default invalid id-key combination

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

- name: Update GeoIP databases
command: '{{ maxmind_update_binary }} -f {{ maxmind_update_configuration }}'
register: geoipupdate_check
failed_when: geoipupdate_check.rc > 1

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.

# Credentials (these defaults are for the free databases)
maxmind_update_userid: '999999'
maxmind_update_licensekey: '000000000000'

I suggest also fixing them to be consistent with the current state.

The "Add Maxmind PPA repository | Ubuntu" task fails in an LXC container(missing GnuPG)

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(?):

- name: Install required packages (Debian / Ubuntu)
package:
name: '{{ item }}'
state: present
with_items:
- gnupg
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'

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.

Role failed at task "Add Maxmind PPA repository | Ubuntu" when `become` is set to False

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.