Compare commits

...

10 Commits

Author SHA1 Message Date
Alex Kotov 8677fabf60
Add package "libnginx-mod-stream" 2024-01-04 06:49:38 +04:00
Alex Kotov da39b240d1
GeoIP2 auto_reload default 2023-08-30 17:32:15 +04:00
Alex Kotov 9d4a1da53b
GeoIP2 auto_reload 2023-08-30 17:25:39 +04:00
Alex Kotov f99c2fc0bc
GeoIP2 2023-08-30 17:14:07 +04:00
Alex Kotov 10ef6f10c5
GeoIP 2023-08-29 22:57:44 +04:00
Alex Kotov 00c7f572f0
Remove Roskomnadzor 2023-08-17 17:17:52 +04:00
Alex Kotov 24b8e5eff5
Organize snippet templates 2023-08-17 16:27:22 +04:00
Alex Kotov eb3a3ef617
Fix typos 2023-08-17 15:13:15 +04:00
Alex Kotov c7ec86c730
Add Roskomnadzor snippet 2023-08-17 14:59:09 +04:00
Alex Kotov 787a68c15c
Improve streams 2023-08-12 21:26:52 +04:00
7 changed files with 60 additions and 7 deletions

View File

@ -4,3 +4,7 @@ nginx__remove_default: true
nginx__upstreams: []
nginx__sites: []
nginx__stream: ''
nginx__geoip_country: null
nginx__geoip_city: null
nginx__geoip2: []

View File

@ -1,7 +1,12 @@
---
- name: Install Nginx
notify: nginx | Restart Nginx
apt:
name: nginx
name:
- libnginx-mod-http-geoip
- libnginx-mod-http-geoip2
- libnginx-mod-stream
- nginx
- name: Create directories for Nginx configuration
notify: nginx | Restart Nginx
@ -39,6 +44,15 @@
owner: root
group: root
- name: Install Nginx configs
notify: nginx | Restart Nginx
template:
src: 'templates/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:
@ -85,7 +99,7 @@
group: root
with_items: '{{ nginx__sites }}'
- name: Install maintenance files
- name: Install additional files
notify: nginx | Restart Nginx
copy:
src: 'files/{{ item }}'
@ -97,11 +111,13 @@
- 'maintenance.html'
- 'maintenance.jpg'
- name: Install maintenance snippet
- name: Install additional snippets
notify: nginx | Restart Nginx
template:
src: 'templates/maintenance.conf'
dest: '{{ nginx__snippets_dir }}/maintenance.conf'
src: 'templates/snippets/{{ item }}.conf'
dest: '{{ nginx__snippets_dir }}/{{ item }}.conf'
mode: 'u=rw,go=r'
owner: root
group: root
with_items:
- 'maintenance'

View File

@ -4,16 +4,20 @@
state: absent
purge: true
name:
- libnginx-mod-http-geoip
- libnginx-mod-http-geoip2
- libnginx-mod-stream
- nginx
- nginx-common
- nginx-core
- nginx-full
- name: Delete Nginx configuration
file:
state: absent
path: '{{ nginx__dir_etc }}'
- name: Delete maintenance files
- name: Delete additional files
file:
state: absent
path: '{{ nginx__dir_www_html }}/{{ item }}'

View File

@ -4,6 +4,10 @@
state: absent
purge: false
name:
- libnginx-mod-http-geoip
- libnginx-mod-http-geoip2
- libnginx-mod-stream
- nginx
- nginx-common
- nginx-core
- nginx-full

View File

@ -0,0 +1,21 @@
{% 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 }} {
{% if geoip2.auto_reload | default(False) %}
auto_reload {{ geoip2.auto_reload }};
{% endif %}
{% for map in geoip2.maps %}
${{ map.var }} {{ map.path }};
{% endfor %}
}
{% endfor %}

View File

@ -7,11 +7,15 @@ events {
worker_connections 768;
# multi_accept on;
}
{% if nginx__stream %}
{% if nginx__stream %}
stream {
include /etc/nginx/stream.conf;
}
{% else %}
#stream {
# include /etc/nginx/stream.conf;
#}
{% endif %}
http {