Skip to content

Commit 6dbbb6d

Browse files
author
adam
committed
feat: allow overriding document_root #15
1 parent 19836bc commit 6dbbb6d

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

defaults/main.yml

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
# apache2_sites:
1515
# - id: mysite (required)
1616
# name: mysite.local (required)
17+
# document_root: ""
1718
# ip: '*'
1819
# port: 80
1920
# state: present

templates/etc/apache2/sites-available/site/body.j2

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
ServerName {{ item.name }}
2+
{% if item.document_root is defined %}
3+
DocumentRoot {{ item.document_root }}
4+
{% else %}
25
DocumentRoot {{ apache2_sites_basedir }}/{{ item.id }}/htdocs
6+
{% endif %}
37
{% for value in item.aliases|default([]) %}
48
ServerAlias {{ value }}
59
{% endfor %}
@@ -12,7 +16,11 @@
1216

1317
# --- directories -----------------------------------------------------------
1418

19+
{% if item.document_root is defined %}
20+
<Directory {{ item.document_root }}>
21+
{% else %}
1522
<Directory {{ apache2_sites_basedir }}/{{ item.id }}/htdocs>
23+
{% endif %}
1624
AllowOverride All
1725
Options FollowSymLinks
1826
Require all granted

0 commit comments

Comments
 (0)