diff --git a/tasks/ssl/acme.yml b/tasks/ssl/acme.yml index 3a6aee3..575ae37 100644 --- a/tasks/ssl/acme.yml +++ b/tasks/ssl/acme.yml @@ -13,7 +13,7 @@ - name: SET_FACT | Assign var with certificates to create set_fact: - acme_create: "{{ acme_create | default([]) + [ (item.item | combine({'listen': ([item.item.acme_port|default(80)]) }) ) ] }}" + acme_create: "{{ acme_create | default([]) }}" with_items: "{{ acme_installed_certs.results }}" when: item.skipped is not defined and not item.stat.exists diff --git a/templates/etc/nginx/conf.d/FAKESITE.conf.j2 b/templates/etc/nginx/conf.d/FAKESITE.conf.j2 index 21fa3dc..5e13b98 100644 --- a/templates/etc/nginx/conf.d/FAKESITE.conf.j2 +++ b/templates/etc/nginx/conf.d/FAKESITE.conf.j2 @@ -1,7 +1,7 @@ server { -{% for port in item.listen | default(['80', '[::]:80']) %} - listen {{ port }}; -{% endfor %} + listen {{ item.acme_port | default('80') }}; + listen [::]:{{ item.acme_port | default('80') }}; + server_name {% if item.name is string %}{{ item.name }}{% else %}{{ item.name | join(" ") }}{% endif %}{% if item.redirect_from is defined %} {% if item.redirect_from is string %}{{ item.redirect_from }}{% else %}{{ item.redirect_from | join(" ") }}{% endif %}{% endif %}; location / {