From a274b2287110e18791e76e77ab71176a225ed315 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Wed, 10 Jun 2015 12:05:13 +0100 Subject: [PATCH] Allow Horizon to access multiple regions This patch introduces the capability for Horizon to access multiple regions. This only takes effect if horizon_available_regions is defined, otherwise the current default comment is applied to the local_settings file. Usage is described via comments in the role defaults and in the etc/openstack_deploy/user_variables.yml file. Change-Id: Ia8c0b8be67fd0f479c492d9919b542806f9b204f --- etc/openstack_deploy/user_variables.yml | 8 ++++++++ playbooks/roles/os_horizon/defaults/main.yml | 6 ++++++ .../os_horizon/templates/horizon_local_settings.py.j2 | 9 +++++++++ 3 files changed, 23 insertions(+) diff --git a/etc/openstack_deploy/user_variables.yml b/etc/openstack_deploy/user_variables.yml index e3a87d61e3..deb9cfc802 100644 --- a/etc/openstack_deploy/user_variables.yml +++ b/etc/openstack_deploy/user_variables.yml @@ -88,3 +88,11 @@ ssl_cipher_suite: "ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AE # HTTP_PROXY: "{{ proxy_env_url }}" # HTTPS_PROXY: "{{ proxy_env_url }}" # NO_PROXY: "{{ no_proxy_env }}" + + +## Multiple region support in Horizon: +# For multiple regions uncomment this configuration, and +# add the extra endpoints below the first list item. +# horizon_available_regions: +# - { url: "{{ keystone_service_internalurl }}", name: "{{ keystone_service_region }}" } +# - { url: "http://cluster1.example.com:5000/v2.0", name: "RegionTwo" } diff --git a/playbooks/roles/os_horizon/defaults/main.yml b/playbooks/roles/os_horizon/defaults/main.yml index 6b8eaee193..364ad61139 100644 --- a/playbooks/roles/os_horizon/defaults/main.yml +++ b/playbooks/roles/os_horizon/defaults/main.yml @@ -67,6 +67,12 @@ horizon_ssl_cert_path: /etc/ssl/certs horizon_ssl_protocol: "{{ ssl_protocol }}" horizon_ssl_cipher_suite: "{{ ssl_cipher_suite }}" +# For multiple regions uncomment this configuration, and +# add the extra endpoints below the first list item. +# horizon_available_regions: +# - { url: "{{ keystone_service_internalurl }}", name: "{{ keystone_service_region }}" } +# - { url: "http://cluster1.example.com:5000/v2.0", name: "RegionTwo" } + ## Launch instance horizon_launch_instance_legacy: True horizon_launch_instance_ng: False diff --git a/playbooks/roles/os_horizon/templates/horizon_local_settings.py.j2 b/playbooks/roles/os_horizon/templates/horizon_local_settings.py.j2 index 833daab6b3..87e246bbb0 100644 --- a/playbooks/roles/os_horizon/templates/horizon_local_settings.py.j2 +++ b/playbooks/roles/os_horizon/templates/horizon_local_settings.py.j2 @@ -155,11 +155,20 @@ EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' # EMAIL_HOST_USER = 'djangomail' # EMAIL_HOST_PASSWORD = 'top-secret!' +{% if horizon_available_regions is defined %} +# Set the regions accessible through Horizon +AVAILABLE_REGIONS = [ +{% for item in horizon_available_regions %} + ('{{ item.url }}', '{{ item.name }}'), +{% endfor %} +] +{% else %} # For multiple regions uncomment this configuration, and add (endpoint, title). # AVAILABLE_REGIONS = [ # ('http://cluster1.example.com:5000/v2.0', 'cluster1'), # ('http://cluster2.example.com:5000/v2.0', 'cluster2'), # ] +{% endif %} OPENSTACK_HOST = "{{ internal_lb_vip_address }}" OPENSTACK_KEYSTONE_URL = "{{ keystone_service_internalurl }}"