mirror of
https://git.lapiole.org/dani/ansible-roles.git
synced 2025-07-27 00:05:44 +02:00
Update to 2021-12-01 19:13
This commit is contained in:
7
roles/geoipupdate/defaults/main.yml
Normal file
7
roles/geoipupdate/defaults/main.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
|
||||
geoip_account_id:
|
||||
geoip_license_key:
|
||||
geoip_edition_ids:
|
||||
- GeoLite2-Country
|
||||
- GeoLite2-City
|
4
roles/geoipupdate/handlers/main.yml
Normal file
4
roles/geoipupdate/handlers/main.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
|
||||
- name: start geoipupdate
|
||||
service: name=geoipupdate state=started
|
32
roles/geoipupdate/tasks/main.yml
Normal file
32
roles/geoipupdate/tasks/main.yml
Normal file
@@ -0,0 +1,32 @@
|
||||
---
|
||||
|
||||
- name: Install geoipupdate
|
||||
yum:
|
||||
name:
|
||||
- geoipupdate
|
||||
tags: geoip
|
||||
|
||||
- name: Deploy configuration
|
||||
template: src=GeoIP.conf.j2 dest=/etc/GeoIP.conf mode=600
|
||||
notify: start geoipupdate
|
||||
tags: geoip
|
||||
|
||||
- name: Deploy geoipupdate units
|
||||
template: src=geoipupdate.{{ item }}.j2 dest=/etc/systemd/system/geoipupdate.{{ item }}
|
||||
loop:
|
||||
- timer
|
||||
- service
|
||||
register: geoip_units
|
||||
tags: geoip
|
||||
|
||||
- name: Reload systemd
|
||||
systemd: daemon_reload=True
|
||||
when: geoip_units.results | selectattr('changed', 'equalto', True) | list | length > 0
|
||||
tags: geoip
|
||||
|
||||
- name: Handle geoip timer
|
||||
systemd:
|
||||
name: geoipupdate.timer
|
||||
state: "{{ (geoip_account_id is defined and geoip_license_key is defined) | ternary('started', 'stopped') }}"
|
||||
enabled: "{{ (geoip_account_id is defined and geoip_license_key is defined) | ternary(True, False) }}"
|
||||
tags: geoip
|
4
roles/geoipupdate/templates/GeoIP.conf.j2
Normal file
4
roles/geoipupdate/templates/GeoIP.conf.j2
Normal file
@@ -0,0 +1,4 @@
|
||||
# {{ ansible_managed }}
|
||||
AccountID {{ geoip_account_id | default('0000000') }}
|
||||
LicenseKey {{ geoip_license_key | default('00000000') }}
|
||||
EditionIDs {{ geoip_edition_ids | join(' ') }}
|
7
roles/geoipupdate/templates/geoipupdate.service.j2
Normal file
7
roles/geoipupdate/templates/geoipupdate.service.j2
Normal file
@@ -0,0 +1,7 @@
|
||||
[Unit]
|
||||
Description=Update MaxMind GeoIP databases
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/bin/geoipupdate
|
||||
TimeoutSec=600
|
9
roles/geoipupdate/templates/geoipupdate.timer.j2
Normal file
9
roles/geoipupdate/templates/geoipupdate.timer.j2
Normal file
@@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Update MaxMind GeoIP databases
|
||||
|
||||
[Timer]
|
||||
OnCalendar=weekly
|
||||
Persistent=yes
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
Reference in New Issue
Block a user