diff --git a/roles/geomirror/meta/main.yml b/roles/geomirror/meta/main.yml index 45b670ef2f7bac4eeaa00137176b025cb3a1293f..d21409a9b8e36a18660cb2b1a6cef8a481721adc 100644 --- a/roles/geomirror/meta/main.yml +++ b/roles/geomirror/meta/main.yml @@ -1,3 +1,5 @@ --- dependencies: - role: geoipupdate + vars: + geoipupdate_edition_ids: GeoLite2-City diff --git a/roles/geomirror/templates/geo.yml.j2 b/roles/geomirror/templates/geo.yml.j2 index 58174918777fe92246f7769125a0e1406635fb80..f9310c2509c93b3e8bc35a7eaadc6b1a3326300a 100644 --- a/roles/geomirror/templates/geo.yml.j2 +++ b/roles/geomirror/templates/geo.yml.j2 @@ -10,24 +10,19 @@ domains: {% for host in groups['geo_mirrors'] %} - ns: {{ host }} {% endfor %} - {% for host in groups['geo_mirrors'] %} - {{ host.split(".")[0] }}.{{ geo_mirror_domain }}: - - a: {{ hostvars[host]['ipv4_address'] }} - - aaaa: {{ hostvars[host]['ipv6_address'] }} - {% endfor %} + - lua: + ttl: 300 + content: > + A "ifurlup('https://{{ geo_mirror_domain }}/lastupdate', + {'{{ groups['geo_mirrors'] | map('extract', hostvars, ['ipv4_address']) | join("', '") }}'}, + {selector='pickclosest', useragent='pdns on {{ inventory_hostname }}'})" + - lua: + ttl: 300 + content: > + AAAA "ifurlup('https://{{ geo_mirror_domain }}/lastupdate', + {'{{ groups['geo_mirrors'] | map('extract', hostvars, ['ipv6_address']) | join("', '") }}'}, + {selector='pickclosest', useragent='pdns on {{ inventory_hostname }}'})" {% if not geomirror_acme_challenge %} _acme-challenge.{{ geo_mirror_domain }}: - ns: mirror.pkgbuild.com {% endif %} - services: - {{ geo_mirror_domain }}: '%mp.geo.mirror.pkgbuild.com' -mapping_lookup_formats: ['%cn'] -custom_mapping: - af: europe - an: europe - as: asia - eu: europe - na: america - oc: asia - sa: america - unknown: europe diff --git a/roles/geomirror/templates/pdns.conf.j2 b/roles/geomirror/templates/pdns.conf.j2 index 8a9c1fbd903b08c549d95ef232b88be5ba74ecc6..6539ab25d0565583c5e0e69d2207d7236a473a4b 100644 --- a/roles/geomirror/templates/pdns.conf.j2 +++ b/roles/geomirror/templates/pdns.conf.j2 @@ -12,5 +12,7 @@ lua-dnsupdate-policy-script=/etc/powerdns/dnsupdate-policy.lua {% else %} launch=geoip {% endif %} -geoip-database-files=/var/lib/GeoIP/GeoLite2-Country.mmdb +geoip-database-files=/var/lib/GeoIP/GeoLite2-City.mmdb geoip-zones-file=/etc/powerdns/geo.yml +enable-lua-records +lua-health-checks-interval=60