Commit 57eef820 authored by ale's avatar ale

Split GeoIP functionality into its own role

parent b46744a8
Pipeline #6199 failed with stages
in 2 minutes and 30 seconds
geoip
===
Maintains a GeoIP (lite) database on the host. Usually included
by other services.
Define the following configuration variable to enable it:
* *geoip_account_id*
* *geoip_license_key*
You will need to register for an account on maxmind.com to obtain
those.
---
- name: Install geoipupdate package
apt:
name: geoipupdate
state: present
# Setup the Country GeoIP database.
- name: Configure GeoIP downloader
template:
src: GeoIP.conf.j2
dest: /etc/GeoIP.conf
when: geoip_account_id is defined
- stat:
path: /var/lib/GeoIP/GeoLite2-Country.mmdb
register: geoip_country
when: geoip_account_id is defined
- name: Download GeoLite2-Country database
shell: geoipupdate
when: geoip_account_id is defined and not geoip_country.stat.exists
- name: Setup geoipupdate cron job
copy:
dest: /etc/cron.d/geoipupdate
content: "12 0 * * 5 root /usr/local/bin/splay 3600 && /usr/bin/geoipupdate"
when: geoip_account_id is defined
...@@ -2,3 +2,4 @@ ...@@ -2,3 +2,4 @@
dependencies: dependencies:
- { role: auth-server } - { role: auth-server }
- { role: auth-server-users } - { role: auth-server-users }
- { role: geoip }
...@@ -7,31 +7,7 @@ ...@@ -7,31 +7,7 @@
vars: vars:
packages: packages:
- sso-server - sso-server
- geoipupdate
# Setup the Country GeoIP database.
- name: Configure GeoIP downloader
template:
src: GeoIP.conf.j2
dest: /etc/GeoIP.conf
when: geoip_account_id is defined
- stat:
path: /var/lib/GeoIP/GeoLite2-Country.mmdb
register: geoip_country
when: geoip_account_id is defined
- name: Download GeoLite2-Country database
shell: geoipupdate
when: geoip_account_id is defined and not geoip_country.stat.exists
- name: Setup geoipupdate cron job
copy:
dest: /etc/cron.d/geoipupdate
content: "12 0 * * 5 root /usr/local/bin/splay 3600 && /usr/bin/geoipupdate"
when: geoip_account_id is defined
# Setup the SSO server.
- user: - user:
name: sso-server name: sso-server
groups: sso-server-credentials groups: sso-server-credentials
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment