From 06df06a3ee02906c21d100fd5418739659140854 Mon Sep 17 00:00:00 2001 From: Menno van Leeuwen Date: Wed, 26 Mar 2025 16:18:37 +0100 Subject: [PATCH] fix: update EchoIP database extraction and cleanup tasks for improved directory structure --- .../tasks/servers/services/echoip/echoip.yml | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/config/ansible/tasks/servers/services/echoip/echoip.yml b/config/ansible/tasks/servers/services/echoip/echoip.yml index 8e094d0..8cfe465 100644 --- a/config/ansible/tasks/servers/services/echoip/echoip.yml +++ b/config/ansible/tasks/servers/services/echoip/echoip.yml @@ -45,38 +45,38 @@ - name: Extract GeoLite2 ASN database ansible.builtin.unarchive: src: "{{ echoip_data_dir }}/GeoLite2-ASN.tar.gz" - dest: "{{ echoip_data_dir }}" + dest: "{{ echoip_data_dir }}/GeoLite2-ASN" remote_src: true register: asn_extracted - name: Extract GeoLite2 City database ansible.builtin.unarchive: src: "{{ echoip_data_dir }}/GeoLite2-City.tar.gz" - dest: "{{ echoip_data_dir }}" + dest: "{{ echoip_data_dir }}/GeoLite2-City" remote_src: true register: city_extracted - name: Extract GeoLite2 Country database ansible.builtin.unarchive: src: "{{ echoip_data_dir }}/GeoLite2-Country.tar.gz" - dest: "{{ echoip_data_dir }}" + dest: "{{ echoip_data_dir }}/GeoLite2-Country" remote_src: true register: country_extracted # Move all databases to the correct locations - name: Move ASN database to correct location 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 - name: Move City database to correct location 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 - name: Move Country database to correct location 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 # Clean up unnecessary files @@ -86,8 +86,9 @@ state: absent - name: Remove extracted ASN folder - ansible.builtin.command: - cmd: "find {{ echoip_data_dir }} -type d -name 'GeoLite2-ASN_*' -exec rm -rf {} +" + ansible.builtin.file: + path: "{{ echoip_data_dir }}/GeoLite2-ASN" + state: absent - name: Remove downloaded City tar.gz file ansible.builtin.file: @@ -95,8 +96,9 @@ state: absent - name: Remove extracted City folder - ansible.builtin.command: - cmd: "find {{ echoip_data_dir }} -type d -name 'GeoLite2-City_*' -exec rm -rf {} +" + ansible.builtin.file: + path: "{{ echoip_data_dir }}/GeoLite2-City" + state: absent - name: Remove downloaded Country tar.gz file ansible.builtin.file: @@ -104,8 +106,9 @@ state: absent - name: Remove extracted Country folder - ansible.builtin.command: - cmd: "find {{ echoip_data_dir }} -type d -name 'GeoLite2-Country_*' -exec rm -rf {} +" + ansible.builtin.file: + path: "{{ echoip_data_dir }}/GeoLite2-Country" + state: absent # Deploy and restart the EchoIP service - name: Deploy EchoIP docker-compose.yml