From 10ef6f10c5daae22cda807ff042923a80527e9a2 Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Tue, 29 Aug 2023 22:56:08 +0400 Subject: [PATCH] GeoIP --- files/conf.d/geoip.conf | 1 + tasks/install.yml | 15 ++++++++++++++- tasks/purge.yml | 2 ++ tasks/remove.yml | 2 ++ 4 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 files/conf.d/geoip.conf diff --git a/files/conf.d/geoip.conf b/files/conf.d/geoip.conf new file mode 100644 index 0000000..b56fc80 --- /dev/null +++ b/files/conf.d/geoip.conf @@ -0,0 +1 @@ +geoip_country /usr/share/GeoIP/GeoIPv6.dat; diff --git a/tasks/install.yml b/tasks/install.yml index 7282e14..f62eb0a 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -1,7 +1,11 @@ --- - name: Install Nginx + notify: nginx | Restart Nginx apt: - name: nginx + name: + - geoip-database + - libnginx-mod-http-geoip + - nginx - name: Create directories for Nginx configuration notify: nginx | Restart Nginx @@ -39,6 +43,15 @@ owner: root group: root +- name: Install Nginx configs + notify: nginx | Restart Nginx + template: + src: 'files/conf.d/geoip.conf' + dest: '{{ nginx__confd_dir }}/geoip.conf' + mode: 'u=rw,go=r' + owner: root + group: root + - name: Install Nginx stream config notify: nginx | Restart Nginx copy: diff --git a/tasks/purge.yml b/tasks/purge.yml index 472da27..c42f495 100644 --- a/tasks/purge.yml +++ b/tasks/purge.yml @@ -4,9 +4,11 @@ state: absent purge: true name: + - libnginx-mod-http-geoip - nginx - nginx-common - nginx-core + - nginx-full - name: Delete Nginx configuration file: diff --git a/tasks/remove.yml b/tasks/remove.yml index 5b59471..2d226d5 100644 --- a/tasks/remove.yml +++ b/tasks/remove.yml @@ -4,6 +4,8 @@ state: absent purge: false name: + - libnginx-mod-http-geoip - nginx - nginx-common - nginx-core + - nginx-full