fix: update EchoIP database extraction and cleanup tasks for improved directory structure
This commit is contained in:
parent
bda85f9b44
commit
06df06a3ee
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user