ServerName {{ item.domain }} {% if item.alias is defined %} ServerAlias {{ item.alias }} {% endif %} ServerAdmin {{ item.ownermail }} DocumentRoot /srv/http/{{ item.domain }} ErrorLog /var/log/apache2/{{ item.domain }}/error.log CustomLog /var/log/apache2/{{ item.domain }}/access.log combined Options +SymlinksIfOwnerMatch +Indexes +MultiViews {% if item.htpasswd is defined %} AuthType Basic AuthName "{{ item.htpasswd_name }}" AuthUserFile "/srv/http/{{ item.domain }}.htpasswd" Require valid-user {% else %} AllowOverride AuthConfig Require all granted {% endif %}