diff --git a/apache/map.jinja b/apache/map.jinja
index e3370750ba8b6459ac6fdab06d3ba06d325c7baa..d9f9afbc2bc56405552742c9c8828e08be0d31bf 100644
--- a/apache/map.jinja
+++ b/apache/map.jinja
@@ -36,6 +36,8 @@
'mod_pagespeed_source': 'https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_amd64.deb',
'mod_xsendfile': 'libapache2-mod-xsendfile',
'mod_fastcgi': 'libapache2-mod-fastcgi',
+ 'mod_geoip': 'libapache2-mod-geoip',
+ 'mod_geoip_database': 'geoip-database',
'vhostdir': '/etc/apache2/sites-available',
'confdir': '/etc/apache2/conf-available',
@@ -59,6 +61,8 @@
'mod_php5': 'php',
'mod_fcgid': 'mod_fcgid',
'mod_pagespeed_source': 'https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_x86_64.rpm',
+ 'mod_geoip': 'mod_geoip',
+ 'mod_geoip_database': 'GeoIP',
'vhostdir': '/etc/httpd/vhosts.d',
'confdir': '/etc/httpd/conf.d',
diff --git a/apache/mod_geoip.sls b/apache/mod_geoip.sls
index 9d77c720a6c774965fbb38ad94fe43c4cd7ac794..a94b4b2601d8c74243acd74a7db0d4c56f45185f 100644
--- a/apache/mod_geoip.sls
+++ b/apache/mod_geoip.sls
@@ -1,6 +1,6 @@
{% from "apache/map.jinja" import apache with context %}
-{% if grains['os_family']=="RedHat" %}
+{% if 'mod_geoip' in apache %}
include:
- apache
@@ -8,14 +8,15 @@ include:
mod-geoip:
pkg.installed:
- pkgs:
- - GeoIP
- - mod_geoip
+ - {{ apache.mod_geoip }}
+ - {{ apache.mod_geoip_database }}
- require:
- pkg: apache
- watch_in:
- module: apache-restart
+{% if grains['os_family']=="RedHat" %}
geoip conf:
file.managed:
- name: {{ apache.confdir }}/geoip.conf
@@ -35,4 +36,4 @@ geoip database:
- salt://apache/files/{{ salt['grains.get']('os_family') }}/GeoIP.dat
{% endif %}
-
+{% endif %}