diff --git a/defaults/main.yml b/defaults/main.yml index 53071ac..ff99869 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -14,6 +14,7 @@ # apache2_sites: # - id: mysite (required) # name: mysite.local (required) +# document_root: "" # ip: '*' # port: 80 # state: present diff --git a/templates/etc/apache2/sites-available/site/body.j2 b/templates/etc/apache2/sites-available/site/body.j2 index d710496..c1415d7 100644 --- a/templates/etc/apache2/sites-available/site/body.j2 +++ b/templates/etc/apache2/sites-available/site/body.j2 @@ -1,5 +1,9 @@ ServerName {{ item.name }} + {% if item.document_root is defined %} + DocumentRoot {{ item.document_root }} + {% else %} DocumentRoot {{ apache2_sites_basedir }}/{{ item.id }}/htdocs + {% endif %} {% for value in item.aliases|default([]) %} ServerAlias {{ value }} {% endfor %} @@ -12,7 +16,11 @@ # --- directories ----------------------------------------------------------- + {% if item.document_root is defined %} + + {% else %} + {% endif %} AllowOverride All Options FollowSymLinks Require all granted