mirror of
https://github.com/HanXHX/ansible-nginx.git
synced 2026-02-24 09:03:29 +07:00
Manage auth basic on all vhost
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{% set __listen = item.listen | default(['80']) %}
|
||||
{% set __listen_ssl = item.listen_ssl | default(['443']) %}
|
||||
{% set __location = item.location | default({}) %}
|
||||
{% macro htpasswd(htpasswd_name, indent=2) -%}
|
||||
{% macro htpasswd(htpasswd_name, indent=1) -%}
|
||||
{% for ht in nginx_htpasswd %}{% if ht.name == htpasswd_name %}
|
||||
{{ "\t" * indent }}auth_basic "{{ ht.description }}";
|
||||
{{ "\t" * indent }}auth_basic_user_file {{ nginx_htpasswd_dir }}/{{ ht.name }};
|
||||
@@ -36,6 +36,10 @@ server {
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if item.htpasswd is defined %}
|
||||
{{ htpasswd(item.htpasswd, 1) }}
|
||||
{% endif %}
|
||||
|
||||
{% if not __location.has_key('/') %}
|
||||
location / {
|
||||
{% block template_try_files %}
|
||||
|
||||
Reference in New Issue
Block a user