diff --git a/defaults/main.yml b/defaults/main.yml index 7d776a7f..569c09f9 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -320,23 +320,23 @@ horizon_pip_packages: - django-appconf - django-openstack-auth - greenlet - - heat_dashboard - horizon - - ironic-ui - - magnum-ui - keystonemiddleware - MySQL-python - PyMySQL - - neutron-lbaas-dashboard - - neutron-fwaas-dashboard - oslo.config - ply - python-memcached - python-keystoneclient - - sahara_dashboard - - trove_dashboard - - designate_dashboard - - octavia_dashboard + - "{{ horizon_enable_sahara_ui | ternary('sahara_dashboard', '') }}" + - "{{ horizon_enable_trove_ui | ternary('trove_dashboard', '') }}" + - "{{ horizon_enable_magnum_ui | ternary('magnum-ui', '') }}" + - "{{ horizon_enable_heat_ui | ternary('heat_dashboard', '') }}" + - "{{ horizon_enable_ironic_ui | ternary('ironic-ui', '') }}" + - "{{ horizon_enable_designate_ui | ternary('designate_dashboard', '') }}" + - "{{ horizon_enable_neutron_lbaas | ternary('neutron-lbaas-dashboard', '') }}" + - "{{ horizon_enable_neutron_fwaas | ternary('neutron-fwaas-dashboard', '') }}" + - "{{ horizon_enable_octavia_ui | ternary('octavia_dashboard', '') }}" # This variable is used to install additional pip packages # that could be needed for additional dashboards @@ -373,5 +373,3 @@ horizon_keystone_admin_roles: # The list of authentication mechanisms which include keystone # federation protocols and identity provider/federation protocol horizon_websso_initial_choice: "credentials" - -horizon_panels: "{{ _horizon_panels }}" diff --git a/tasks/horizon_install.yml b/tasks/horizon_install.yml index ea3866d2..d246568a 100644 --- a/tasks/horizon_install.yml +++ b/tasks/horizon_install.yml @@ -51,7 +51,7 @@ - name: Install distro packages package: - name: "{{ horizon_package_list}}" + name: "{{ horizon_package_list }}" state: "{{ horizon_package_state }}" update_cache: "{{ (ansible_pkg_mgr == 'apt') | ternary('yes', omit) }}" cache_valid_time: "{{ (ansible_pkg_mgr == 'apt') | ternary(cache_timeout, omit) }}" diff --git a/tasks/horizon_install_source.yml b/tasks/horizon_install_source.yml index 7998943d..269aa4eb 100644 --- a/tasks/horizon_install_source.yml +++ b/tasks/horizon_install_source.yml @@ -92,3 +92,41 @@ - { path: "{{ horizon_lib_dir }}/openstack_dashboard", mode: "2755" } - { path: "{{ horizon_lib_dir }}/openstack_dashboard/local", mode: "2755" } - { path: "{{ horizon_lib_dir }}/openstack_dashboard/local/enabled", mode: "2755" } + +- name: Registering dashboards + find: + paths: "{{ horizon_lib_dir }}" + patterns: "^.*(dashboard|ui)$" + file_type: directory + use_regex: yes + excludes: "openstack_dashboard" + recurse: no + register: found_dashboards + +# NOTE(noonedeadpunk): +# patterns made not optimal, as ansible find module doesn't +# process regexp with repeats, like [0-9]{2,4}. +# Bug describing this issue: +# https://github.com/ansible/ansible/issues/45048 +- name: Registering panels + find: + paths: |- + {% set dashboard_path = [] %} + {% for dashboard in found_dashboards.files %} + {% for path in _dashboard_panels_location %} + {% set _ = dashboard_path.append(dashboard.path + path) %} + {% endfor %} + {% endfor %} + {{ dashboard_path }} + patterns: "^(_[0-9]{4}_.*.py|_[0-9]{2}_.*.py|.*_policy.json)$" + file_type: file + use_regex: yes + register: found_panels + +- name: Enable project panels + file: + src: "{{ item.path }}" + path: "{{ horizon_dashboard_panel_dir }}/{{ item.path|basename }}" + state: link + with_items: "{{ found_panels.files }}" + notify: Restart apache2 diff --git a/tasks/horizon_post_install.yml b/tasks/horizon_post_install.yml index 768967b1..460200ae 100644 --- a/tasks/horizon_post_install.yml +++ b/tasks/horizon_post_install.yml @@ -48,14 +48,6 @@ dest: "{{ horizon_lib_dir }}/openstack_dashboard/static/dashboard/{{ item.value.dest }}" with_dict: "{{ horizon_custom_uploads | default({}) }}" -- name: Enable project panels - file: - src: "{{ item.src }}" - path: "{{ item.path }}" - state: "{{ item.state }}" - with_items: "{{ horizon_panels }}" - notify: Restart apache2 - - name: Create horizon links file: src: "{{ item.src }}" diff --git a/vars/distro_install.yml b/vars/distro_install.yml index f18ce983..68c05221 100644 --- a/vars/distro_install.yml +++ b/vars/distro_install.yml @@ -17,6 +17,3 @@ horizon_package_list: "{{ horizon_distro_packages + horizon_service_distro_packa _horizon_bin: "/usr/bin" horizon_manage: "{{ ansible_python.executable }} {{ horizon_lib_dir }}/manage.py" -# NOTE(hwoarang): Distributions ship regular files in _horizon_lib_dir so we need -# to set the proper state in the file module -horizon_panel_enable_state: "file" diff --git a/vars/main.yml b/vars/main.yml index e22825fc..fca303aa 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -13,104 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -_horizon_panels: - - src: "{{ horizon_lib_dir }}/heat_dashboard/enabled/_1610_project_orchestration_panel.py" - path: "{{ horizon_dashboard_panel_dir }}/_1610_project_orchestration_panel.py" - state: "{{ horizon_enable_heat_ui | ternary(horizon_panel_enable_state, 'absent') }}" - - src: "{{ horizon_lib_dir }}/heat_dashboard/enabled/_1620_project_stacks_panel.py" - path: "{{ horizon_dashboard_panel_dir }}/_1620_project_stacks_panel.py" - state: "{{ horizon_enable_heat_ui | ternary(horizon_panel_enable_state, 'absent') }}" - - src: "{{ horizon_lib_dir }}/heat_dashboard/enabled/_1630_project_resource_types_panel.py" - path: "{{ horizon_dashboard_panel_dir }}/_1630_project_resource_types_panel.py" - state: "{{ horizon_enable_heat_ui | ternary(horizon_panel_enable_state, 'absent') }}" - - src: "{{ horizon_lib_dir }}/heat_dashboard/enabled/_1640_project_template_versions_panel.py" - path: "{{ horizon_dashboard_panel_dir }}/_1640_project_template_versions_panel.py" - state: "{{ horizon_enable_heat_ui | ternary(horizon_panel_enable_state, 'absent') }}" - - src: "{{ horizon_lib_dir }}/heat_dashboard/enabled/_1650_project_template_generator_panel.py" - path: "{{ horizon_dashboard_panel_dir }}/_1650_project_template_generator_panel.py" - state: "{{ horizon_enable_heat_ui | ternary(horizon_panel_enable_state, 'absent') }}" - - src: "{{ horizon_lib_dir }}/heat_dashboard/local_settings.d/_1699_orchestration_settings.py" - path: "{{ horizon_lib_dir }}/openstack_dashboard/local/local_settings.d/_1699_orchestration_settings.py" - state: "{{ horizon_enable_heat_ui | ternary(horizon_panel_enable_state, 'absent') }}" - - src: "{{ horizon_lib_dir }}/heat_dashboard/conf/heat_policy.json" - path: "{{ horizon_lib_dir }}/openstack_dashboard/conf/heat_policy.json" - state: "{{ horizon_enable_heat_ui | ternary(horizon_panel_enable_state, 'absent') }}" - - src: "{{ horizon_lib_dir }}/designatedashboard/enabled/_1710_project_dns_panel_group.py" - path: "{{ horizon_dashboard_panel_dir }}/_1710_project_dns_panel_group.py" - state: "{{ horizon_enable_designate_ui | ternary(horizon_panel_enable_state, 'absent') }}" - - src: "{{ horizon_lib_dir }}/designatedashboard/enabled/_1720_project_dns_panel.py" - path: "{{ horizon_dashboard_panel_dir }}/_1720_project_dns_panel.py" - state: "{{ horizon_enable_designate_ui | ternary(horizon_panel_enable_state, 'absent') }}" - - src: "{{ horizon_lib_dir }}/designatedashboard/enabled/_1721_dns_zones_panel.py" - path: "{{ horizon_dashboard_panel_dir }}/_1721_dns_zones_panel.py" - state: "{{ horizon_enable_designate_ui | ternary(horizon_panel_enable_state, 'absent') }}" - - src: "{{ horizon_lib_dir }}/designatedashboard/enabled/_1722_dns_reversedns_panel.py" - path: "{{ horizon_dashboard_panel_dir }}/_1722_dns_reversedns_panel.py" - state: "{{ horizon_enable_designate_ui | ternary(horizon_panel_enable_state, 'absent') }}" - - src: "{{ horizon_lib_dir }}/ironic_ui/enabled/_2200_ironic.py" - path: "{{ horizon_dashboard_panel_dir }}/_2200_ironic.py" - state: "{{ horizon_enable_ironic_ui | ternary(horizon_panel_enable_state, 'absent') }}" - - src: "{{ horizon_lib_dir }}/magnum_ui/enabled/_1370_project_container_infra_panel_group.py" - path: "{{ horizon_dashboard_panel_dir }}/_1370_project_container_infra_panel_group.py" - state: "{{ horizon_enable_magnum_ui | ternary(horizon_panel_enable_state, 'absent') }}" - - src: "{{ horizon_lib_dir }}/magnum_ui/enabled/_1371_project_container_infra_clusters_panel.py" - path: "{{ horizon_dashboard_panel_dir }}/_1371_project_container_infra_clusters_panel.py" - state: "{{ horizon_enable_magnum_ui | ternary(horizon_panel_enable_state, 'absent') }}" - - src: "{{ horizon_lib_dir }}/magnum_ui/enabled/_1372_project_container_infra_cluster_templates_panel.py" - path: "{{ horizon_dashboard_panel_dir }}/_1372_project_container_infra_cluster_templates_panel.py" - state: "{{ horizon_enable_magnum_ui | ternary(horizon_panel_enable_state, 'absent') }}" - - src: "{{ horizon_lib_dir }}/sahara_dashboard/enabled/_1810_data_processing_panel_group.py" - path: "{{ horizon_dashboard_panel_dir }}/_1810_data_processing_panel_group.py" - state: "{{ horizon_enable_sahara_ui | ternary(horizon_panel_enable_state, 'absent') }}" - - src: "{{ horizon_lib_dir }}/sahara_dashboard/enabled/_1820_data_processing_clusters_panel.py" - path: "{{ horizon_dashboard_panel_dir }}/_1820_data_processing_clusters_panel.py" - state: "{{ horizon_enable_sahara_ui | ternary(horizon_panel_enable_state, 'absent') }}" - - src: "{{ horizon_lib_dir }}/sahara_dashboard/enabled/_1830_data_processing_plugins_panel.py" - path: "{{ horizon_dashboard_panel_dir }}/_1830_data_processing_plugins_panel.py" - state: "{{ horizon_enable_sahara_ui | ternary(horizon_panel_enable_state, 'absent') }}" - - src: "{{ horizon_lib_dir }}/sahara_dashboard/enabled/_1840_data_processing_jobs_panel.py" - path: "{{ horizon_dashboard_panel_dir }}/_1840_data_processing_jobs_panel.py" - state: "{{ horizon_enable_sahara_ui | ternary(horizon_panel_enable_state, 'absent') }}" - - src: "{{ horizon_lib_dir }}/sahara_dashboard/local_settings.d/_12_toggle_data_upload_max_number_fields.py" - path: "{{ horizon_lib_dir }}/openstack_dashboard/local/local_settings.d/_12_toggle_data_upload_max_number_fields.py" - state: "{{ horizon_enable_sahara_ui | ternary(horizon_panel_enable_state, 'absent') }}" - - src: "{{ horizon_lib_dir }}/trove_dashboard/enabled/_1710_database_panel_group.py" - path: "{{ horizon_dashboard_panel_dir }}/_1710_database_panel_group.py" - state: "{{ horizon_enable_trove_ui | ternary(horizon_panel_enable_state, 'absent') }}" - - src: "{{ horizon_lib_dir }}/trove_dashboard/enabled/_1720_project_databases_panel.py" - path: "{{ horizon_dashboard_panel_dir }}/_1720_project_databases_panel.py" - state: "{{ horizon_enable_trove_ui | ternary(horizon_panel_enable_state, 'absent') }}" - - src: "{{ horizon_lib_dir }}/trove_dashboard/enabled/_1730_project_database_backups_panel.py" - path: "{{ horizon_dashboard_panel_dir }}/_1730_project_database_backups_panel.py" - state: "{{ horizon_enable_trove_ui | ternary(horizon_panel_enable_state, 'absent') }}" - - src: "{{ horizon_lib_dir }}/trove_dashboard/enabled/_1731_project_database_backups_panel.py" - path: "{{ horizon_dashboard_panel_dir }}/_1731_project_database_backups_panel.py" - state: "{{ horizon_enable_trove_ui | ternary(horizon_panel_enable_state, 'absent') }}" - - src: "{{ horizon_lib_dir }}/trove_dashboard/enabled/_1740_project_database_clusters_panel.py" - path: "{{ horizon_dashboard_panel_dir }}/_1740_project_database_clusters_panel.py" - state: "{{ horizon_enable_trove_ui | ternary(horizon_panel_enable_state, 'absent') }}" - - src: "{{ horizon_lib_dir }}/trove_dashboard/enabled/_1760_project_database_configurations_panel.py" - path: "{{ horizon_dashboard_panel_dir }}/_1760_project_database_configurations_panel.py" - state: "{{ horizon_enable_trove_ui | ternary(horizon_panel_enable_state, 'absent') }}" - - src: "{{ horizon_lib_dir }}/neutron_lbaas_dashboard/enabled/_1481_project_ng_loadbalancersv2_panel.py" - path: "{{ horizon_dashboard_panel_dir }}/_1481_project_ng_loadbalancersv2_panel.py" - state: "{{ (horizon_enable_neutron_lbaas | bool) | ternary(horizon_panel_enable_state, 'absent') }}" - - src: "{{ horizon_lib_dir }}/neutron_fwaas_dashboard/enabled/_7010_project_firewalls_common.py" - path: "{{ horizon_dashboard_panel_dir }}/_7010_project_firewalls_common.py" - state: "{{ (horizon_enable_neutron_fwaas | bool) | ternary(horizon_panel_enable_state, 'absent') }}" - - src: "{{ horizon_lib_dir }}/neutron_fwaas_dashboard/enabled/_7011_project_firewalls_panel.py" - path: "{{ horizon_dashboard_panel_dir }}/_7011_project_firewalls_panel.py" - state: "{{ (horizon_enable_neutron_fwaas | bool) | ternary(horizon_panel_enable_state, 'absent') }}" - - src: "{{ horizon_lib_dir }}/neutron_fwaas_dashboard/enabled/_7012_project_firewalls_v2_panel.py" - path: "{{ horizon_dashboard_panel_dir }}/_7012_project_firewalls_v2_panel.py" - state: "{{ (horizon_enable_neutron_fwaas | bool) | ternary(horizon_panel_enable_state, 'absent') }}" - - src: "{{ horizon_lib_dir }}/octavia_dashboard/enabled/_1482_project_load_balancer_panel.py" - path: "{{ horizon_dashboard_panel_dir }}/_1482_project_load_balancer_panel.py" - state: "{{ (horizon_enable_octavia_ui | bool) | ternary(horizon_panel_enable_state, 'absent') }}" - _horizon_translations_pull: - project: "horizon" enabled: True - project: "heat-dashboard" enabled: "{{ horizon_enable_heat_ui }}" - diff --git a/vars/source_install.yml b/vars/source_install.yml index 4522b375..524b38f8 100644 --- a/vars/source_install.yml +++ b/vars/source_install.yml @@ -17,5 +17,8 @@ _horizon_bin: "/openstack/venvs/horizon-{{ horizon_venv_tag }}/bin" _horizon_lib_dir: "{{ _horizon_bin | dirname }}/lib/python2.7/dist-packages" horizon_python_lib_dir: "{{ _horizon_lib_dir }}" horizon_manage: "{{ _horizon_bin }}/horizon-manage.py" -horizon_panel_enable_state: "link" horizon_dashboard_panel_dir: "{{ _horizon_lib_dir }}/openstack_dashboard/local/enabled" +_dashboard_panels_location: + - "/enabled" + - "/conf" + - "/local_settings.d"