---
- name: Download DBIP Database
  get_url:
    url: "https://download.db-ip.com/free/dbip-city-lite-{{ ansible_date_time.year }}-{{ ansible_date_time.month }}.mmdb.gz"
    dest: "{{ app_base }}/dbip/dbip-city-lite.mmdb.gz"

- name: Extract DBIP Database
  shell: "gunzip -f dbip-city-lite.mmdb.gz"
  args:
    chdir: "{{ app_base }}/dbip"

- name: Set DBIP Database Permissions
  file:
    path: "{{ app_base }}/dbip/dbip-city-lite.mmdb"
    state: file
    mode: "u=rwx,g=rx,o=rx"
    owner: "azuracast"
    group: "www-data"
