Cleanup to standard setup
diff --git a/horizon/map.jinja b/horizon/map.jinja
index 72e237d..9ea2fdf 100644
--- a/horizon/map.jinja
+++ b/horizon/map.jinja
@@ -7,6 +7,8 @@
'apache_config': '/etc/apache2/conf-available/openstack-dashboard.conf',
'certs_dir': '/etc/ssl/certs',
'private_dir': '/etc/ssl/private',
+ 'port_config_file': '/etc/apache2/ports.conf',
+ 'port_config_template': 'salt://horizon/conf/ports.conf',
'cache': {'host': '127.0.0.1', 'port': 11211}
},
'RedHat': {
@@ -17,6 +19,8 @@
'apache_config': '/etc/httpd/conf.d/openstack-dashboard.conf',
'certs_dir': '/etc/pki/tls/certs',
'private_dir': '/etc/pki/tls/private',
+ 'port_config_file': '/etc/httpd/conf/httpd.conf',
+ 'port_config_template': 'salt://horizon/conf/httpd.conf.RedHat',
'cache': {'host': '127.0.0.1', 'port': 11211}
},
}, merge=salt['pillar.get']('horizon:server')) %}
diff --git a/horizon/server/init.sls b/horizon/server/init.sls
index 0c6d9b2..8b77234 100644
--- a/horizon/server/init.sls
+++ b/horizon/server/init.sls
@@ -5,5 +5,11 @@
- horizon.server.multi.site
{%- else %}
{# production way #}
-- horizon.server.single
+- horizon.server.service
+{%- if pillar.horizon.server.plugin is defined %}
+- horizon.server.plugin
+{%- endif %}
+{%- if pillar.horizon.server.ssl is defined %}
+- horizon.server.ssl
+{%- endif %}
{%- endif %}
diff --git a/horizon/server/plugin.sls b/horizon/server/plugin.sls
new file mode 100644
index 0000000..b653936
--- /dev/null
+++ b/horizon/server/plugin.sls
@@ -0,0 +1,22 @@
+{%- from "horizon/map.jinja" import server with context %}
+{%- if server.enabled %}
+
+{%- if grains.os == "ubuntu" %}
+
+horizon_ubuntu_theme_absent:
+ pkg.purged:
+ - name: openstack-dashboard-ubuntu-theme
+
+{%- endif %}
+
+{%- for plugin_name, plugin in server.get('plugin', {}).iteritems() %}
+
+horizon_{{ plugin_name }}_package:
+ pkg.installed:
+ - name: {{ plugin.source.name }}
+ - watch_in:
+ - service: horizon_services
+
+{%- endfor %}
+
+{%- endif %}
\ No newline at end of file
diff --git a/horizon/server/single/init.sls b/horizon/server/service.sls
similarity index 67%
rename from horizon/server/single/init.sls
rename to horizon/server/service.sls
index c008e18..ee994a8 100644
--- a/horizon/server/single/init.sls
+++ b/horizon/server/service.sls
@@ -1,29 +1,6 @@
{%- from "horizon/map.jinja" import server with context %}
{%- if server.enabled %}
-{%- if server.ssl is defined %}
-include:
-- horizon.server.single.ssl
-{%- endif %}
-
-{%- if grains.os == "ubuntu" %}
-
-horizon_ubuntu_theme_absent:
- pkg.purged:
- - name: openstack-dashboard-ubuntu-theme
-
-{%- endif %}
-
-{%- for plugin_name, plugin in server.get('plugin', {}) %}
-
-horizon_{{ plugin_name }}_package:
- pkg.installed:
- - name: {{ plugin.source.name }}
- - watch_in:
- - service: horizon_services
-
-{%- endfor %}
-
horizon_packages:
pkg.installed:
- names: {{ server.pkgs }}
@@ -39,12 +16,10 @@
- require:
- pkg: horizon_packages
-{%- if grains.os_family == 'RedHat' %}
-
horizon_apache_port_config:
file.managed:
- - name: /etc/httpd/conf/httpd.conf
- - source: salt://horizon/conf/httpd.conf.RedHat
+ - name: {{ server.port_config_file }}
+ - source: {{ server.port_config_template }}
- template: jinja
- mode: 644
- user: root
@@ -54,25 +29,6 @@
- require:
- pkg: horizon_packages
-{%- endif %}
-
-{%- if grains.os_family == 'Debian' %}
-
-horizon_apache_port_config:
- file.managed:
- - name: /etc/apache2/ports.conf
- - source: salt://horizon/conf/ports.conf
- - template: jinja
- - mode: 644
- - user: root
- - group: root
- - require_in:
- - service: horizon_services
- - require:
- - pkg: horizon_packages
-
-{%- endif %}
-
horizon_apache_config:
file.managed:
- name: {{ server.apache_config }}
diff --git a/horizon/server/single/ssl.sls b/horizon/server/ssl.sls
similarity index 99%
rename from horizon/server/single/ssl.sls
rename to horizon/server/ssl.sls
index a29768c..7cf2a36 100644
--- a/horizon/server/single/ssl.sls
+++ b/horizon/server/ssl.sls
@@ -1,5 +1,4 @@
{%- from "horizon/map.jinja" import server with context %}
-
{%- if server.ssl.enabled %}
horizon_ssl_packages:
@@ -59,4 +58,4 @@
- require_in:
- service: horizon_services
-{%- endif %}
+{%- endif %}
\ No newline at end of file