roles/nginx: Reworked upstreams
parent
6c310a8f3d
commit
309d23ba8a
@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
# backend: 12345
|
|
||||||
upstream_name: "localhost{{ backend }}"
|
|
||||||
keep_alive: 32
|
|
@ -1,4 +0,0 @@
|
|||||||
upstream {{ upstream_name }} {
|
|
||||||
keepalive {{ keep_alive }};
|
|
||||||
server localhost:{{ backend }};
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
# backend: /example.socket
|
|
||||||
upstream_name: "{{ backend | basename }}"
|
|
||||||
keep_alive: 32
|
|
@ -1,4 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
dependencies:
|
|
||||||
- role: nginx/application
|
|
@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
- name: Configure upstream for service on {{ backend }}
|
|
||||||
template:
|
|
||||||
src: upstream.conf
|
|
||||||
dest: "{{ nginx_upstreams_directory }}/{{ upstream_name }}"
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
mode: "u=rw,g=r,o=r"
|
|
||||||
notify: reload nginx
|
|
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
backend: "{{ (backend_port is defined) | ternary(backend_port, backend_socket) }}"
|
||||||
|
backend_full: "{{ (backend_type == 'port') | ternary('localhost', 'unix') }}:{{ backend }}"
|
||||||
|
backend_type: "{{ (backend_port is defined) | ternary('port', 'socket') }}"
|
||||||
|
upstream_name: "{{ (backend_type == 'port') | ternary('localhost' + backend, backend | basename) }}"
|
||||||
|
keep_alive: 32
|
@ -1,4 +1,6 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
|
allow_duplicates: yes
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
- role: nginx/application
|
- role: nginx/application
|
@ -1,4 +1,4 @@
|
|||||||
upstream {{ upstream_name }} {
|
upstream {{ upstream_name }} {
|
||||||
keepalive {{ keep_alive }};
|
keepalive {{ keep_alive }};
|
||||||
server unix:{{ backend }};
|
server {{ backend_full }};
|
||||||
}
|
}
|
Loading…
Reference in New Issue