Initial commit
This commit is contained in:
commit
8c23da5bf5
5
handlers/main.yml
Normal file
5
handlers/main.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- name: reload nginx
|
||||||
|
service:
|
||||||
|
name: nginx
|
||||||
|
state: restarted
|
18
meta/main.yml
Normal file
18
meta/main.yml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
dependencies: []
|
||||||
|
|
||||||
|
galaxy_info:
|
||||||
|
role_name: nginx-stream
|
||||||
|
author: 'Pierre-Olivier Mercier <nemunaire+iac@nemunai.re>'
|
||||||
|
description: Initial configuration for nginx-stream
|
||||||
|
license: GPL-3.0-or-later
|
||||||
|
min_ansible_version: 2.9
|
||||||
|
platforms:
|
||||||
|
- name: Alpine
|
||||||
|
versions:
|
||||||
|
- all
|
||||||
|
- name: Debian
|
||||||
|
versions:
|
||||||
|
- all
|
||||||
|
galaxy_tags: []
|
21
tasks/main.yml
Normal file
21
tasks/main.yml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
---
|
||||||
|
- name: ensure conf.d directory exists
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "/etc/nginx/conf.d/"
|
||||||
|
state: directory
|
||||||
|
|
||||||
|
- name: install nginx-stream module
|
||||||
|
apk:
|
||||||
|
name:
|
||||||
|
- nginx-mod-stream
|
||||||
|
state: present
|
||||||
|
tags:
|
||||||
|
- packages
|
||||||
|
|
||||||
|
- name: configure nginx with stream module
|
||||||
|
template:
|
||||||
|
src: nginx.conf.j2
|
||||||
|
dest: "/etc/nginx/conf.d/stream.conf"
|
||||||
|
mode: 0644
|
||||||
|
notify:
|
||||||
|
- reload nginx
|
30
templates/nginx.conf.j2
Normal file
30
templates/nginx.conf.j2
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
stream {
|
||||||
|
log_format main
|
||||||
|
'$ssl_preread_server_name > $remote_addr [$time_local] ';
|
||||||
|
|
||||||
|
{% if nginx_stream_access_log is defined %}
|
||||||
|
access_log {{ nginx_stream_access_log}} main;
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
map_hash_bucket_size 48;
|
||||||
|
|
||||||
|
map $ssl_preread_server_name $targetSslBackend {
|
||||||
|
|
||||||
|
default {{ nginx_stream_default_endpoint}};
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443;
|
||||||
|
|
||||||
|
proxy_connect_timeout 1s;
|
||||||
|
{% if nginx_resolvers is defined %}
|
||||||
|
resolver {% for r in nginx_resolvers %}{% if ":" in r %}[{{ r }}]{% else %}{{ r }}{% endif %} {% endfor %};
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
proxy_pass $targetSslBackend;
|
||||||
|
{% if no_proxy_protocol is not defined %}
|
||||||
|
proxy_protocol on;
|
||||||
|
{% endif %}
|
||||||
|
ssl_preread on;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user