Skip to content

Commit

Permalink
[ADD] Logic for handling if not SSL cert was generated.
Browse files Browse the repository at this point in the history
Signed-off-by: ecaepp <[email protected]>
  • Loading branch information
ecaepp committed Dec 10, 2018
1 parent 19f06c4 commit ab0102c
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions templates/server.conf.j2
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
# Managed by Ansible

server {
server_name {{item.server_name}}; {# Required #}
listen {{ item.listen_port }}; {# Required #}
server_name {{item.server_name}};
listen {{ item.listen_port }} ssl;

root {{ item.root_dir }}/{{ item.server_name }}; {# Required #}
index {{ item.index_name | default('index.html')}}; {# Required #}
root {{ item.root_dir }}/{{ item.server_name }};
index {{ item.index_name | default('index.html')}};

{# Checks if `ssl` setting have been defined in the vhost file and configures them if they are #}
# Configure Crypto Keys/Certificates/DH
{% if item.ssl is defined and item.ssl != None%}
ssl_certificate {{ item.ssl.cert_dir}}/{{ item.ssl.crt | default('server.crt')}};
ssl_certificate_key {{ item.ssl.cert_dir}}/{{ item.ssl.key | default('server.key')}};
{% if selfsigned_cert == true %}
{%- if item.ssl is defined and item.ssl != None -%}
ssl_certificate {{ item.ssl.crt | default('{{ item.ssl.cert_dir}}/server.crt')}};
ssl_certificate_key {{ item.ssl.key | default('item.ssl.cert_dir}}/server.key')}};
{%- endif %}
{% endif %}

{# Checks if `security_headers` is set in vhost file and configures them if so #}
Expand Down

0 comments on commit ab0102c

Please sign in to comment.