openstack-ansible-os_horizon/tasks/horizon_install_source.yml
Dmitriy Rabotjagov 60ae573179 Moved compilemessages to handlers
As there were 2 compilemessages tasks in different places and one of
them was executed on every launch, in order to remove dublicated code
and ease it's maintenance, this task was moved to handlers.

Change-Id: Ic9c0de9248c8bd3cd796aa2a338cc57afba57446
2019-03-19 15:59:04 +02:00

145 lines
5.8 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: Create horizon dir
file:
path: "{{ item.path }}"
state: directory
owner: "{{ item.owner|default(horizon_system_user_name) }}"
group: "{{ item.group|default(horizon_system_group_name) }}"
mode: "{{ item.mode|default('0755') }}"
with_items:
- { path: "/etc/pki/tls/certs", owner: "root", group: "root" }
- { path: "/etc/pki/tls/private", owner: "root", group: "root" }
- { path: "/var/log/httpd", mode: "2755" }
when: ansible_pkg_mgr in ['yum', 'dnf']
- name: Create system links
file:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
state: "link"
with_items:
- { src: "/etc/pki/tls/certs", dest: "/etc/ssl/certs" }
- { src: "/etc/pki/tls/private", dest: "/etc/ssl/private" }
- { src: "/var/log/httpd", dest: "/var/log/apache2" }
when: ansible_pkg_mgr in ['yum', 'dnf']
# TODO(odyssey4me):
# This can be simplified once all the roles are using
# python_venv_build. We can then switch to using a
# set of constraints in pip.conf inside the venv,
# perhaps prepared by giving a giving a list of
# constraints to the role.
- name: Create developer mode constraint file
copy:
dest: "/opt/developer-pip-constraints.txt"
content: |
{% for item in horizon_developer_constraints %}
{{ item }}
{% endfor %}
when: horizon_developer_mode | bool
- name: Ensure remote wheel building is disabled in developer mode
set_fact:
venv_build_host: "{{ inventory_hostname }}"
when:
- horizon_developer_mode | bool
- name: Install the python venv
include_role:
name: "python_venv_build"
vars:
venv_build_distro_package_list: "{{ horizon_devel_distro_packages }}"
venv_install_destination_path: "{{ horizon_bin | dirname }}"
venv_pip_install_args: "{{ horizon_pip_install_args }}"
venv_pip_packages: >-
{{ horizon_pip_packages | union(horizon_user_pip_packages) + horizon_optional_pip_packages +
(horizon_enable_blazar_ui | bool) | ternary(horizon_blazar_optional_pip_packages, []) +
(horizon_enable_cloudkitty_ui | bool) | ternary(horizon_cloudkitty_optional_pip_packages, []) +
(horizon_enable_designate_ui | bool) | ternary(horizon_designate_optional_pip_packages, []) +
(horizon_enable_heat_ui | bool) | ternary(horizon_heat_optional_pip_packages, []) +
(horizon_enable_ironic_ui | bool) | ternary(horizon_ironic_optional_pip_packages, []) +
(horizon_enable_magnum_ui | bool) | ternary(horizon_magnum_optional_pip_packages, []) +
(horizon_enable_masakari_ui | bool) | ternary(horizon_masakari_optional_pip_packages, []) +
(horizon_enable_neutron_fwaas | bool) | ternary(horizon_neutron_fwaas_optional_pip_packages, []) +
(horizon_enable_neutron_lbaas | bool) | ternary(horizon_neutron_lbaas_optional_pip_packages, []) +
(horizon_enable_neutron_vpnaas | bool) | ternary(horizon_neutron_vpnaas_optional_pip_packages, []) +
(horizon_enable_octavia_ui | bool) | ternary(horizon_octavia_optional_pip_packages, []) +
(horizon_enable_sahara_ui | bool) | ternary(horizon_sahara_optional_pip_packages, []) +
(horizon_enable_tacker_ui | bool) | ternary(horizon_tacker_optional_pip_packages, []) +
(horizon_enable_trove_ui | bool) | ternary(horizon_trove_optional_pip_packages, []) +
(horizon_enable_watcher_ui | bool) | ternary(horizon_watcher_optional_pip_packages, []) +
(horizon_enable_zun_ui | bool) | ternary(horizon_zun_optional_pip_packages, []) }}
venv_facts_when_changed:
- section: "horizon"
option: "venv_tag"
value: "{{ horizon_venv_tag }}"
- name: Create horizon link for venv
file:
src: "{{ horizon_lib_dir | dirname }}/site-packages"
dest: "{{ horizon_lib_dir }}"
owner: "{{ horizon_system_user_name }}"
group: "{{ horizon_system_group_name }}"
state: "link"
- name: Create static horizon dir
file:
path: "{{ item.path }}"
state: "directory"
owner: "{{ item.owner|default(horizon_system_user_name) }}"
group: "{{ item.group|default(horizon_system_group_name) }}"
with_items:
- { path: "{{ horizon_lib_dir }}/static", mode: "2755" }
- { 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
- 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]{2,4}_.*.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:
- Compile messages
- Restart apache2