diff --git a/defaults/main.yml b/defaults/main.yml index c7bc114c..bcf454b2 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -275,9 +275,12 @@ _horizon_available_themes: theme_label: "Material" theme_path: "themes/material" -# Add custom themes. Deployers need to place the theme directories -# and files on the horizon containers in: -# {{ horizon_lib_dir }}/openstack_dashboard/themes +# Add custom themes. Deployers need to place the archive, with the theme inside, +# into the directory, which is specified by theme_src_archive key. +# It should be an absolute path to the archive on the deployment host. +# Leading folders are not expected in the archive. +# Following archive formats are supported: +# .tar.gz, .tgz, .zip, .tar.bz, .tar.bz2, .tbz, .tbz2 # See https://docs.openstack.org/horizon/latest/configuration/themes.html # for more details on custom themes # Example: @@ -287,6 +290,7 @@ _horizon_available_themes: # theme_name: "custom" # theme_label: "Custom" # theme_path: "themes/custom" +# theme_src_archive: "/etc/openstack_deploy/horizon/themes/custom.tar.gz" # horizon_custom_themes: {} diff --git a/releasenotes/notes/drop-custom-themes-724c40e5cd69b8e2.yaml b/releasenotes/notes/drop-custom-themes-724c40e5cd69b8e2.yaml new file mode 100644 index 00000000..1d0c8e7e --- /dev/null +++ b/releasenotes/notes/drop-custom-themes-724c40e5cd69b8e2.yaml @@ -0,0 +1,10 @@ +--- +features: + - The ``os_horizon`` role now supports distribution of user custom themes. + Deployers can use the new key ``theme_src_archive`` of ``horizon_custom_themes`` + dictionary to provide absolute path to the archived theme. + Only .tar.gz, .tgz, .zip, .tar.bz, .tar.bz2, .tbz, .tbz2 archives are supported. + Structure inside archive should be as a standard theme, without any leading folders. +fixes: + - Fixes bug https://bugs.launchpad.net/openstack-ansible/+bug/1778098 where playbook failed, if + ``horizon_custom_themes`` is specified, and directory for theme is not provided diff --git a/tasks/horizon_post_install.yml b/tasks/horizon_post_install.yml index 84a0e4fb..768967b1 100644 --- a/tasks/horizon_post_install.yml +++ b/tasks/horizon_post_install.yml @@ -96,6 +96,25 @@ notify: Restart apache2 when: horizon_customization_module is defined +- name: Creating horizon custom theme path + file: + path: "{{ horizon_lib_dir }}/openstack_dashboard/{{ item.value.theme_path }}/" + state: directory + owner: "{{ horizon_system_user_name }}" + group: "{{ horizon_system_group_name }}" + mode: "0755" + with_dict: "{{ horizon_custom_themes }}" + +- name: Drop horizon custom themes + unarchive: + src: "{{ item.value.theme_src_archive }}" + dest: "{{ horizon_lib_dir }}/openstack_dashboard/{{ item.value.theme_path }}/" + owner: "{{ horizon_system_user_name }}" + group: "{{ horizon_system_group_name }}" + with_dict: "{{ horizon_custom_themes }}" + when: item.value.theme_src_archive is defined + notify: Restart apache2 + - name: Compile messages for translation command: "{{ horizon_manage }} compilemessages" become: yes