Make ssl optional for listeners (#215)

This commit is contained in:
Seena Fallah 2020-01-09 19:10:36 +03:30 committed by Alessandro Fael Garcia
parent d661ff4db9
commit 0b176f847a
3 changed files with 4 additions and 1 deletions

View File

@ -347,6 +347,7 @@ This is a sample playbook file for deploying the Ansible Galaxy NGINX role in a
listen_localhost: listen_localhost:
ip: 0.0.0.0 ip: 0.0.0.0
port: 8081 port: 8081
ssl: false
opts: [] opts: []
server_name: localhost server_name: localhost
error_page: /usr/share/nginx/html error_page: /usr/share/nginx/html
@ -371,6 +372,7 @@ This is a sample playbook file for deploying the Ansible Galaxy NGINX role in a
listen_localhost: listen_localhost:
ip: 0.0.0.0 ip: 0.0.0.0
port: 8082 port: 8082
ssl: false
opts: [] opts: []
server_name: localhost server_name: localhost
error_page: /usr/share/nginx/html error_page: /usr/share/nginx/html

View File

@ -64,6 +64,7 @@ nginx_http_template:
listen_localhost: listen_localhost:
ip: localhost # Wrap in square brackets for IPv6 addresses ip: localhost # Wrap in square brackets for IPv6 addresses
port: 8081 port: 8081
ssl: true
opts: [] # Listen opts like http2 which will be added (ssl is automatically added if you specify 'ssl:'). opts: [] # Listen opts like http2 which will be added (ssl is automatically added if you specify 'ssl:').
server_name: localhost server_name: localhost
include_files: [] include_files: []

View File

@ -80,7 +80,7 @@ auth_request_set {{ item.value.auth_request_set_http.name }} {{ item.value.auth_
{% for server in item.value.servers %} {% for server in item.value.servers %}
server { server {
{% for listen in item.value.servers[server].listen %} {% for listen in item.value.servers[server].listen %}
listen {% if item.value.servers[server].listen[listen].ip is defined and item.value.servers[server].listen[listen].ip | length %}{{ item.value.servers[server].listen[listen].ip }}:{% endif %}{{ item.value.servers[server].listen[listen].port }}{% if item.value.servers[server].ssl is defined and item.value.servers[server].ssl %} ssl{% endif %}{% if item.value.servers[server].listen[listen].opts is defined and item.value.servers[server].listen[listen].opts | length %} {{ item.value.servers[server].listen[listen].opts | join(" ") }}{% endif %}; listen {% if item.value.servers[server].listen[listen].ip is defined and item.value.servers[server].listen[listen].ip | length %}{{ item.value.servers[server].listen[listen].ip }}:{% endif %}{{ item.value.servers[server].listen[listen].port }}{% if item.value.servers[server].listen[listen].ssl is defined and item.value.servers[server].listen[listen].ssl %} ssl{% endif %}{% if item.value.servers[server].listen[listen].opts is defined and item.value.servers[server].listen[listen].opts | length %} {{ item.value.servers[server].listen[listen].opts | join(" ") }}{% endif %};
{% endfor %} {% endfor %}
server_name {{ item.value.servers[server].server_name | default('localhost') }}; server_name {{ item.value.servers[server].server_name | default('localhost') }};
{% if item.value.servers[server].ssl is defined and item.value.servers[server].ssl %} {% if item.value.servers[server].ssl is defined and item.value.servers[server].ssl %}