Merge "Adding API v3 version for horizon"
diff --git a/horizon/server/service.sls b/horizon/server/service.sls
index 4110bb1..b195ab7 100644
--- a/horizon/server/service.sls
+++ b/horizon/server/service.sls
@@ -61,6 +61,11 @@
 
 {%- endfor %}
 
+{# The approach to render config file "horizon/files/openstack-dashboard.conf" from package is #}
+{# going to be remove in 2018.11.0 + 2 releases                                                #}
+
+{%- if pillar.get('apache', {}).get('server', {}).get('site', {}).horizon is not defined %}
+
 horizon_apache_config:
   file.managed:
   - name: {{ server.apache_config }}
@@ -73,7 +78,7 @@
     - pkg: horizon_packages
 
 {%- if grains.os_family == 'Debian' %}
-apache_enable_wsgi:
+apache_enable_horizon_wsgi:
   apache_module.enabled:
     - name: wsgi
 
@@ -82,7 +87,34 @@
   - name: openstack-dashboard
   - require:
     - file: horizon_apache_config
-    - apache_module: apache_enable_wsgi
+    - apache_module: apache_enable_horizon_wsgi
+{%- endif %}
+
+{%- else %}
+
+apache_horizon_conf_cleanup_legacy:
+  apache_conf.disabled:
+  - name: openstack-dashboard
+
+cleanup_configs:
+  file.absent:
+    - name: {{ server.apache_config }}
+    - require:
+      - apache_conf: apache_horizon_conf_cleanup_legacy
+
+horizon_apache_config:
+  file.exists:
+  - name: /etc/apache2/sites-available/wsgi_openstack_web.conf
+  - require:
+    - pkg: horizon_packages
+    - cleanup_configs
+
+apache_enable_horizon_wsgi:
+  apache_site.enabled:
+    - name: wsgi_openstack_web
+    - require:
+      - horizon_apache_config
+
 {%- endif %}
 
 horizon_services:
diff --git a/horizon/upgrade/render_config.sls b/horizon/upgrade/render_config.sls
index 2379a91..0f626d9 100644
--- a/horizon/upgrade/render_config.sls
+++ b/horizon/upgrade/render_config.sls
@@ -50,13 +50,4 @@
 
 {%- endfor %}
 
-horizon_apache_config:
-  file.managed:
-  - name: {{ server.apache_config }}
-  - source: salt://horizon/files/openstack-dashboard.conf.{{ grains.os_family }}
-  - template: jinja
-  - mode: 644
-  - user: root
-  - group: root
-
 {%- endif %}