3d60097f94
Old style of dashboards linking was replaced with find module. horizon_panels variable was removed. Now deployer may install extra dashboard with pip package, and it will be linked by role in case of correct structure and naming. Task for linking found dashboards was moved to horizon_install_source, as we don't need linking during installation from packages. Added _dashboard_panels_location - it's a list with subdirs inside dashboard folders, where panels should be located. horizon_panel_enable_state variable was also removed, as we don't try to link dashboards in post_install anymore. Depends-on: I708b5cf32e5cce6a18624d0b3be0cd4c828ad389 Change-Id: Ia76d959aa03ff67703bd41bd7ea418ea49a91df7
136 lines
4.7 KiB
YAML
136 lines
4.7 KiB
YAML
---
|
|
# Copyright 2014, Rackspace US, Inc.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
- name: Ensure horizon dirs are accessible by user
|
|
file:
|
|
path: "{{ item.path }}"
|
|
state: directory
|
|
owner: "{{ horizon_system_user_name }}"
|
|
group: "{{ horizon_system_group_name }}"
|
|
mode: "0755"
|
|
recurse: yes
|
|
with_items:
|
|
- { path: "{{ horizon_lib_dir }}", fixup: True }
|
|
- { path: "/etc/openstack-dashboard", fixup: "{{ (ansible_os_family | lower) == 'redhat' }}" }
|
|
when: item.fixup
|
|
|
|
# TODO(hwoarang): See if we can use local_settings.py from the distribution packages
|
|
# when horizon_install_method == 'distro'
|
|
- name: Setup Horizon config(s)
|
|
template:
|
|
src: "{{ item.src }}"
|
|
dest: "{{ item.dest }}"
|
|
owner: "{{ item.owner|default(horizon_system_user_name) }}"
|
|
group: "{{ horizon_system_group_name }}"
|
|
mode: "{{ item.mode }}"
|
|
with_items:
|
|
- { src: "horizon_local_settings.py.j2", dest: "/etc/horizon/local_settings.py", owner: "root", mode: "0640", always_install: True }
|
|
- { src: "horizon-manage.py.j2", dest: "{{ horizon_bin }}/horizon-manage.py", mode: "0755", always_install: "{{ (horizon_install_method == 'source') }}" }
|
|
- { src: "80_admin_default_panel.py.j2", dest: "{{ horizon_lib_dir }}/openstack_dashboard/local/enabled/_80_admin_default_panel.py", mode: "0755", always_install: True }
|
|
when: item.always_install
|
|
notify: Restart apache2
|
|
|
|
- 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({}) }}"
|
|
|
|
- name: Create horizon links
|
|
file:
|
|
src: "{{ item.src }}"
|
|
dest: "{{ item.dest }}"
|
|
owner: "{{ horizon_system_user_name }}"
|
|
group: "{{ horizon_system_group_name }}"
|
|
state: "link"
|
|
force: yes
|
|
with_items:
|
|
- { src: "/etc/horizon/local_settings.py", dest: "{{ horizon_lib_dir }}/openstack_dashboard/local/local_settings.py" }
|
|
|
|
- name: Setup Horizon config(s)
|
|
template:
|
|
src: "{{ item.src }}"
|
|
dest: "{{ item.dest }}"
|
|
owner: "{{ horizon_system_user_name }}"
|
|
group: "{{ horizon_system_group_name }}"
|
|
with_items:
|
|
- { src: "horizon_django.wsgi.j2", dest: "{{ horizon_lib_wsgi_file }}" }
|
|
notify: Restart apache2
|
|
|
|
- name: Create customization module directory
|
|
file:
|
|
path: "{{ horizon_lib_dir }}/horizon_customization"
|
|
state: directory
|
|
owner: "{{ horizon_system_user_name }}"
|
|
group: "{{ horizon_system_group_name }}"
|
|
mode: "0755"
|
|
when: horizon_customization_module is defined
|
|
|
|
- name: Drop horizon customization module
|
|
template:
|
|
src: "{{ horizon_customization_module }}"
|
|
dest: "{{ horizon_lib_dir }}/horizon_customization/__init__.py"
|
|
owner: "{{ horizon_system_user_name }}"
|
|
group: "{{ horizon_system_group_name }}"
|
|
mode: "0644"
|
|
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
|
|
become_user: "{{ horizon_system_user_name }}"
|
|
args:
|
|
chdir: "{{ item }}"
|
|
changed_when: false
|
|
with_items:
|
|
- "{{ horizon_python_lib_dir }}/horizon"
|
|
- "{{ horizon_lib_dir }}/openstack_dashboard"
|
|
register: async_compile_messages
|
|
async: 600
|
|
poll: 0
|
|
|
|
- name: Collect and compress static files
|
|
command: "{{ item }}"
|
|
become: yes
|
|
become_user: "{{ horizon_system_user_name }}"
|
|
changed_when: false
|
|
with_items:
|
|
- "{{ horizon_manage }} collectstatic --noinput"
|
|
- "{{ horizon_manage }} compress --force"
|
|
notify: Restart apache2
|
|
register: async_compress_static_files
|
|
async: 600
|
|
poll: 0
|