diff --git a/.gitignore b/.gitignore index 8a7407a55958ece3660f0494185ecf8f865945c4..9ceecccd3893a2881311259929f7f1164800f065 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ +inventory/group_vars/geodns.yml .ssh/id_* diff --git a/README.md b/README.md index fa451ab8e4d3effad82497e9694c4958677da990..950ad15dc7a9dba63c8a093d7dc21924ff287d11 100644 --- a/README.md +++ b/README.md @@ -25,3 +25,8 @@ During deploy, (Apache) virtualhost ServerNames will be generated by the followi * proxy-[realm].[tld] Make sure you have DNS entries for those hostnames in geoDNS configuration. + +## geoDNS servers +To automatically download geoDNS GeoLite2DB's add a file ```geodns.yml``` to ```inventory/group_vars``` with the following content: + +```geodns_licence: <your license key>``` diff --git a/roles/geodns/tasks/main.yml b/roles/geodns/tasks/main.yml index cbf5218d811834e00e1bba6820ed8051c9ffc07f..a92b0590e5f711d89fb50c9a201632c2251f8bbc 100644 --- a/roles/geodns/tasks/main.yml +++ b/roles/geodns/tasks/main.yml @@ -62,15 +62,20 @@ notify: - "enable geodns job" -- name: Copy GeoLite2DB's - ansible.builtin.copy: - src: "{{ item }}" +- name: Download GeoLite2DB's + ansible.builtin.unarchive: + src: "https://download.maxmind.com/app/geoip_download?edition_id={{ item }}&license_key={{ geodns_licence }}&suffix=tar.gz" dest: "{{ geolite_dir }}" mode: '0644' + extra_opts: '--strip-components=1' + remote_src: yes with_items: - - GeoLite2-Country.mmdb + - GeoLite2-ASN + - GeoLite2-City + - GeoLite2-Country notify: - "enable geodns job" + when: geodns_licence is defined - name: Create geoDNS config ansible.builtin.template: