honzamach.geoip

Role geoip

Overview: This is an Ansible role for installing free IP geolocation databases called GeoLite2 from MaxMind.

Links:

Table of Contents:

  • Installation
  • Dependencies
  • Usage
  • Variables
  • Managed Files
  • Author

Installation

To install the honzamach.geoip role from Ansible Galaxy, run:

ansible-galaxy install honzamach.geoip

To install it directly from GitHub, clone the repository with:

git clone https://github.com/honzamach/ansible-role-geoip.git honzamach.geoip

Cloning from GitHub makes it easier to update the role when a new version is released.


Dependencies

This role does not rely on any other roles. However, the following roles depend on it:

  • mentat
  • mentat_dev

Usage

Example Inventory File (inventory):

[servers_geoip]
your-server

Example Playbook (role_playbook.yml):

- hosts: servers_geoip
  remote_user: root
  roles:
    - role: honzamach.geoip
  tags:
    - role-geoip

Running the Playbook:

ansible-playbook --ask-vault-pass --inventory inventory role_playbook.yml

Configuration Recommendations:

  1. In inventory/group_vars/all/vars.yml, define default settings for all servers:

    hm_geoip__account_id: "{{ vault_hm_geoip__account_id }}"
    hm_geoip__license_key: "{{ vault_hm_geoip__license_key }}"
    
  2. Create an encrypted file inventory/group_vars/all/vault.yml to store sensitive information:

    vault_hm_geoip__account_id: 123456
    vault_hm_geoip__license_key: something-so-secret-no1-is-gonna-guess
    
  3. Use inventory/host_vars/[your-server]/vars.yml to set server-specific configurations.


Configuration Variables

Internal Role Variables:

  • hm_geoip__package_url: URL to install the geoipupdate utility.

    • Default: https://github.com/maxmind/geoipupdate/releases/download/v4.1.5/geoipupdate_4.1.5_linux_amd64.deb
  • hm_geoip__account_id: Your MaxMind account ID (numeric).

    • Default: null
  • hm_geoip__license_key: Your MaxMind license key.

    • Default: null
  • hm_geoip__edition_ids: List of databases to install.

    • Default: ["GeoLite2-ASN", "GeoLite2-City", "GeoLite2-Country"]
  • hm_geoip__database_directory: Directory for database files.

    • Default: /usr/share/GeoIP

Built-in Ansible Variables:

  • ansible_lsb['codename']: Used for custom templates.

Managed Files

This role manages the following files:

  • /etc/cron.d/geoipupdate (Template)
  • /etc/GeoIP.conf (Template)

Author and License

Informazioni sul progetto

Ansible role for convenient installation of the free IP geolocation databases GeoLite2 provided by MaxMind.

Installa
ansible-galaxy install honzamach.geoip
Licenza
mit
Download
169
Proprietario