From 79eb06fddb5a3f92eff3d4b8540580f9999a47df 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 --- defaults/main.yml | 6 ++++++ templates/horizon_local_settings.py.j2 | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/defaults/main.yml b/defaults/main.yml index 6b8eaee1..364ad611 100644 --- a/defaults/main.yml +++ b/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/templates/horizon_local_settings.py.j2 b/templates/horizon_local_settings.py.j2 index 833daab6..87e246bb 100644 --- a/templates/horizon_local_settings.py.j2 +++ b/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 }}"