GeoIP2
This commit is contained in:
parent
10ef6f10c5
commit
f99c2fc0bc
6 changed files with 26 additions and 3 deletions
|
@ -4,3 +4,7 @@ nginx__remove_default: true
|
||||||
nginx__upstreams: []
|
nginx__upstreams: []
|
||||||
nginx__sites: []
|
nginx__sites: []
|
||||||
nginx__stream: ''
|
nginx__stream: ''
|
||||||
|
|
||||||
|
nginx__geoip_country: null
|
||||||
|
nginx__geoip_city: null
|
||||||
|
nginx__geoip2: []
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
geoip_country /usr/share/GeoIP/GeoIPv6.dat;
|
|
|
@ -3,8 +3,8 @@
|
||||||
notify: nginx | Restart Nginx
|
notify: nginx | Restart Nginx
|
||||||
apt:
|
apt:
|
||||||
name:
|
name:
|
||||||
- geoip-database
|
|
||||||
- libnginx-mod-http-geoip
|
- libnginx-mod-http-geoip
|
||||||
|
- libnginx-mod-http-geoip2
|
||||||
- nginx
|
- nginx
|
||||||
|
|
||||||
- name: Create directories for Nginx configuration
|
- name: Create directories for Nginx configuration
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
- name: Install Nginx configs
|
- name: Install Nginx configs
|
||||||
notify: nginx | Restart Nginx
|
notify: nginx | Restart Nginx
|
||||||
template:
|
template:
|
||||||
src: 'files/conf.d/geoip.conf'
|
src: 'templates/conf.d/geoip.conf'
|
||||||
dest: '{{ nginx__confd_dir }}/geoip.conf'
|
dest: '{{ nginx__confd_dir }}/geoip.conf'
|
||||||
mode: 'u=rw,go=r'
|
mode: 'u=rw,go=r'
|
||||||
owner: root
|
owner: root
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
purge: true
|
purge: true
|
||||||
name:
|
name:
|
||||||
- libnginx-mod-http-geoip
|
- libnginx-mod-http-geoip
|
||||||
|
- libnginx-mod-http-geoip2
|
||||||
- nginx
|
- nginx
|
||||||
- nginx-common
|
- nginx-common
|
||||||
- nginx-core
|
- nginx-core
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
purge: false
|
purge: false
|
||||||
name:
|
name:
|
||||||
- libnginx-mod-http-geoip
|
- libnginx-mod-http-geoip
|
||||||
|
- libnginx-mod-http-geoip2
|
||||||
- nginx
|
- nginx
|
||||||
- nginx-common
|
- nginx-common
|
||||||
- nginx-core
|
- nginx-core
|
||||||
|
|
18
templates/conf.d/geoip.conf
Normal file
18
templates/conf.d/geoip.conf
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
{% if nginx__geoip_country %}
|
||||||
|
geoip_country {{ nginx__geoip_country }};
|
||||||
|
{% else %}
|
||||||
|
#geoip_country path/to/GeoIP.dat;
|
||||||
|
{% endif %}
|
||||||
|
{% if nginx__geoip_city %}
|
||||||
|
geoip_city {{ nginx__geoip_city }};
|
||||||
|
{% else %}
|
||||||
|
#geoip_city path/to/GeoLiteCity.dat;
|
||||||
|
{% endif %}
|
||||||
|
{% for geoip2 in nginx__geoip2 %}
|
||||||
|
|
||||||
|
geoip2 {{ geoip2.file }} {
|
||||||
|
{% for map in geoip2.maps %}
|
||||||
|
${{ map.var }} {{ map.path }};
|
||||||
|
{% endfor %}
|
||||||
|
}
|
||||||
|
{% endfor %}
|
Loading…
Reference in a new issue