fix: update EchoIP database extraction and cleanup tasks for improved directory structure
Some checks failed
Ansible Lint Check / check-ansible (push) Failing after 12s
Nix Format Check / check-format (push) Successful in 45s
Python Lint Check / check-python (push) Failing after 10s

This commit is contained in:
Menno van Leeuwen 2025-03-26 16:18:37 +01:00
parent bda85f9b44
commit 06df06a3ee
Signed by: vleeuwenmenno
SSH Key Fingerprint: SHA256:OJFmjANpakwD3F2Rsws4GLtbdz1TJ5tkQF0RZmF0TRE

View File

@ -45,38 +45,38 @@
- name: Extract GeoLite2 ASN database - name: Extract GeoLite2 ASN database
ansible.builtin.unarchive: ansible.builtin.unarchive:
src: "{{ echoip_data_dir }}/GeoLite2-ASN.tar.gz" src: "{{ echoip_data_dir }}/GeoLite2-ASN.tar.gz"
dest: "{{ echoip_data_dir }}" dest: "{{ echoip_data_dir }}/GeoLite2-ASN"
remote_src: true remote_src: true
register: asn_extracted register: asn_extracted
- name: Extract GeoLite2 City database - name: Extract GeoLite2 City database
ansible.builtin.unarchive: ansible.builtin.unarchive:
src: "{{ echoip_data_dir }}/GeoLite2-City.tar.gz" src: "{{ echoip_data_dir }}/GeoLite2-City.tar.gz"
dest: "{{ echoip_data_dir }}" dest: "{{ echoip_data_dir }}/GeoLite2-City"
remote_src: true remote_src: true
register: city_extracted register: city_extracted
- name: Extract GeoLite2 Country database - name: Extract GeoLite2 Country database
ansible.builtin.unarchive: ansible.builtin.unarchive:
src: "{{ echoip_data_dir }}/GeoLite2-Country.tar.gz" src: "{{ echoip_data_dir }}/GeoLite2-Country.tar.gz"
dest: "{{ echoip_data_dir }}" dest: "{{ echoip_data_dir }}/GeoLite2-Country"
remote_src: true remote_src: true
register: country_extracted register: country_extracted
# Move all databases to the correct locations # Move all databases to the correct locations
- name: Move ASN database to correct location - name: Move ASN database to correct location
ansible.builtin.command: ansible.builtin.command:
cmd: "find {{ echoip_data_dir }} -name GeoLite2-ASN.mmdb -exec mv {} {{ echoip_data_dir }}/GeoLite2-ASN.mmdb \\;" cmd: "mv {{ echoip_data_dir }}/GeoLite2-ASN/GeoLite2-ASN.mmdb {{ echoip_data_dir }}/GeoLite2-ASN.mmdb"
when: asn_extracted.changed when: asn_extracted.changed
- name: Move City database to correct location - name: Move City database to correct location
ansible.builtin.command: ansible.builtin.command:
cmd: "find {{ echoip_data_dir }} -name GeoLite2-City.mmdb -exec mv {} {{ echoip_data_dir }}/GeoLite2-City.mmdb \\;" cmd: "mv {{ echoip_data_dir }}/GeoLite2-City/GeoLite2-City.mmdb {{ echoip_data_dir }}/GeoLite2-City.mmdb"
when: city_extracted.changed when: city_extracted.changed
- name: Move Country database to correct location - name: Move Country database to correct location
ansible.builtin.command: ansible.builtin.command:
cmd: "find {{ echoip_data_dir }} -name GeoLite2-Country.mmdb -exec mv {} {{ echoip_data_dir }}/GeoLite2-Country.mmdb \\;" cmd: "mv {{ echoip_data_dir }}/GeoLite2-Country/GeoLite2-Country.mmdb {{ echoip_data_dir }}/GeoLite2-Country.mmdb"
when: country_extracted.changed when: country_extracted.changed
# Clean up unnecessary files # Clean up unnecessary files
@ -86,8 +86,9 @@
state: absent state: absent
- name: Remove extracted ASN folder - name: Remove extracted ASN folder
ansible.builtin.command: ansible.builtin.file:
cmd: "find {{ echoip_data_dir }} -type d -name 'GeoLite2-ASN_*' -exec rm -rf {} +" path: "{{ echoip_data_dir }}/GeoLite2-ASN"
state: absent
- name: Remove downloaded City tar.gz file - name: Remove downloaded City tar.gz file
ansible.builtin.file: ansible.builtin.file:
@ -95,8 +96,9 @@
state: absent state: absent
- name: Remove extracted City folder - name: Remove extracted City folder
ansible.builtin.command: ansible.builtin.file:
cmd: "find {{ echoip_data_dir }} -type d -name 'GeoLite2-City_*' -exec rm -rf {} +" path: "{{ echoip_data_dir }}/GeoLite2-City"
state: absent
- name: Remove downloaded Country tar.gz file - name: Remove downloaded Country tar.gz file
ansible.builtin.file: ansible.builtin.file:
@ -104,8 +106,9 @@
state: absent state: absent
- name: Remove extracted Country folder - name: Remove extracted Country folder
ansible.builtin.command: ansible.builtin.file:
cmd: "find {{ echoip_data_dir }} -type d -name 'GeoLite2-Country_*' -exec rm -rf {} +" path: "{{ echoip_data_dir }}/GeoLite2-Country"
state: absent
# Deploy and restart the EchoIP service # Deploy and restart the EchoIP service
- name: Deploy EchoIP docker-compose.yml - name: Deploy EchoIP docker-compose.yml