Merge "Adding directory and module parameters"
diff --git a/README.rst b/README.rst
index b99b3c1..6590959 100644
--- a/README.rst
+++ b/README.rst
@@ -453,6 +453,31 @@
           status: 'disabled'
 
 
+Apache directories and modules management
+
+.. code-block:: yaml
+
+  apache:
+     server:
+       enabled: true
+       site:
+         sitename:
+           directories:
+             dashboard_static:
+               path: /usr/share/openstack-dashboard/static
+               order: 'allow,deny'
+               allow: 'from all'
+               modules:
+                 mod_expires.c:
+                   ExpiresActive: 'On'
+                   ExpiresDefault: '"access 6 month"'
+                 mod_deflate.c:
+                   SetOutputFilter: 'DEFLATE'
+             dashboard_wsgi:
+               path: /usr/share/openstack-dashboard/openstack_dashboard/wsgi
+               order: 'allow,deny'
+               allow: 'from all'
+
 More Information
 ================
 
diff --git a/apache/files/_dir.conf b/apache/files/_dir.conf
new file mode 100644
index 0000000..5dba4bd
--- /dev/null
+++ b/apache/files/_dir.conf
@@ -0,0 +1,26 @@
+{%- from "apache/map.jinja" import server with context -%}
+  {%- if site.directories is defined %}
+    {%- for dir_name, dir_params in site.directories.items() %}
+
+  <Directory {{ dir_params.path }}>
+    {%- if dir_params.auth is defined %}
+      {%- set auth = dir_params.auth %}
+      {%- include "apache/files/_auth.conf" %}
+    {%- else %}
+    AuthType none
+    Require all granted
+    {%- endif %}
+    {%- if dir_params.order is defined %}
+    Order {{ dir_params.order }}
+    {%- endif %}
+    {%- if dir_params.allow is defined %}
+    Allow {{ dir_params.allow }}
+    {%- endif %}
+    {%- if dir_params.modules is defined %}
+      {%- set _modules = dir_params.modules %}
+      {%- include "apache/files/_modules.conf" %}
+    {%- endif %}
+  </Directory>
+
+    {%- endfor %}
+  {%- endif %}
diff --git a/apache/files/_modules.conf b/apache/files/_modules.conf
new file mode 100644
index 0000000..1a3c5f6
--- /dev/null
+++ b/apache/files/_modules.conf
@@ -0,0 +1,9 @@
+{%- if _modules is defined %}
+  {%- for module, params in _modules.items() %}
+    <IfModule {{ module }}>
+    {%- for k, v in params.items() %}
+      {{ k }} {{ v }}
+    {%- endfor %}
+    </IfModule>
+  {%- endfor %}
+{%- endif %}
diff --git a/apache/files/wsgi.conf b/apache/files/wsgi.conf
index 23f9afe..cad01dc 100644
--- a/apache/files/wsgi.conf
+++ b/apache/files/wsgi.conf
@@ -14,7 +14,8 @@
   {%- include "apache/files/_core.conf" %}
   {%- include "apache/files/_log.conf" %}
   {%- include "apache/files/_limits.conf" %}
-
+  {%- include "apache/files/_locations.conf" %}
+  {%- include "apache/files/_dir.conf" %}
 
   <Directory /usr/bin>
     <IfVersion >= 2.4>