From c62b54d891eecd17f50de62415eb8aa7a9b09e09 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Evrard Date: Mon, 23 Nov 2015 17:28:24 +0100 Subject: [PATCH] Allow Horizon Custom Branding This introduces 2 variables: ``horizon_site_name`` and ``horizon_custom_uploads``. The former needs to set with a string. It will edit the local settings of horizon to add the cloud's name. The latter is a dict, that contains path to source and destination files that the deployer wants to upload. For example, if setting the dict as followed: horizon_custom_uploads: logo: src: '/etc/openstack_deploy/files/logo.png' dest: "img/logo.png" logosplash: src: '/etc/openstack_deploy/files/logo-splash.png' dest: "img/logo-splash.png" You'll overwrite the img/logo.png and img/logo-splash.png files on the horizon nodes (inside their folder "{{ horizon_lib_dir }}/openstack_dashboard/static/dashboard/") with the files stored on the deployment node at the src location. Change-Id: I1a74e74968d09f6e299dbd965f9c87368c4d646c --- tasks/horizon_post_install.yml | 10 ++++++++++ templates/horizon_local_settings.py.j2 | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/tasks/horizon_post_install.yml b/tasks/horizon_post_install.yml index ea82206d..9a28bfb7 100644 --- a/tasks/horizon_post_install.yml +++ b/tasks/horizon_post_install.yml @@ -45,6 +45,16 @@ notify: Restart apache2 tags: - horizon-configs + - horizon-branding + +- name: Uploading horizon custom files + copy: + src: "{{ item.value.src }}" + dest: "{{ horizon_lib_dir }}/openstack_dashboard/static/dashboard/{{ item.value.dest }}" + with_dict: "{{ horizon_custom_uploads | default({}) }}" + when: horizon_custom_uploads is defined + tags: + - horizon-branding - name: Create horizon links file: diff --git a/templates/horizon_local_settings.py.j2 b/templates/horizon_local_settings.py.j2 index 893de61e..e895fd97 100644 --- a/templates/horizon_local_settings.py.j2 +++ b/templates/horizon_local_settings.py.j2 @@ -710,3 +710,7 @@ REST_API_REQUIRED_SETTINGS = ['OPENSTACK_HYPERVISOR_FEATURES'] # For more information see: # http://tinyurl.com/anticlickjack #DISALLOW_IFRAME_EMBED = True + +{% if horizon_site_name is defined %} +SITE_BRANDING = '{{ horizon_site_name }}' +{% endif %}