diff --git a/README.rst b/README.rst index 94382db..e9db7a8 100644 --- a/README.rst +++ b/README.rst @@ -38,7 +38,7 @@ Enables and disables Apache modules. ``apache.mod_rewrite`` ---------------------- -Enabled the Apache module mod_rewrite (Debian only) +Enabled the Apache module mod_rewrite (Debian and FreeBSD only) ``apache.mod_proxy`` ------------------- diff --git a/apache/files/FreeBSD/mod_rewrite.conf.jinja b/apache/files/FreeBSD/mod_rewrite.conf.jinja new file mode 100644 index 0000000..4e14e01 --- /dev/null +++ b/apache/files/FreeBSD/mod_rewrite.conf.jinja @@ -0,0 +1,3 @@ +{% from "apache/map.jinja" import apache with context %} + +LoadModule rewrite_module libexec/{{ apache.service }}/mod_rewrite.so diff --git a/apache/mod_rewrite.sls b/apache/mod_rewrite.sls index 5f86ab3..03bc2ba 100644 --- a/apache/mod_rewrite.sls +++ b/apache/mod_rewrite.sls @@ -1,8 +1,9 @@ -{% if grains['os_family']=="Debian" %} +{% from "apache/map.jinja" import apache with context %} include: - apache +{% if grains['os_family']=="Debian" %} a2enmod rewrite: cmd.run: - unless: ls /etc/apache2/mods-enabled/rewrite.load @@ -12,4 +13,16 @@ a2enmod rewrite: - watch_in: - module: apache-restart +{% elif grains['os_family']=="FreeBSD" %} + +{{ apache.modulesdir }}/040_mod_rewrite.conf: + file.managed: + - source: salt://apache/files/{{ salt['grains.get']('os_family') }}/mod_rewrite.conf.jinja + - mode: 644 + - template: jinja + - require: + - pkg: apache + - watch_in: + - module: apache-restart + {% endif %}