openstack-ansible-os_horizon/tasks/horizon_install_source.yml
Jonathan Rosser 39c6022bf6 Override pyScss version for python3.10
Openstack upper-constraints for the Yoga release does not specify
a version of pyScss which is compatible with python3.10, this only
starts to happen with the Zed release.

To obtain experimental support for Ubuntu Jammy with the Yoga
release we adjust the upper-constraints to describe a python3.10
compatible version of pyScss.

Change-Id: I04b7b8bc2c8e666f155cccf58bd920ee7d699d72
2022-05-03 09:11:02 +01:00

180 lines
7.1 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" }
when: ansible_facts['pkg_mgr'] == '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" }
when: ansible_facts['pkg_mgr'] == 'dnf'
# NOTE(jrosser)
# horizon appears in u-c as is it used as a library for the horizon plugins
# the new pip resolver will fail to install horizon if two contradictory
# constraints are given which will always happen with a source install
# and wheels built on the repo server. We must filter horizon out of u-c.
- name: Retrieve the constraints URL
uri:
url: "{{ horizon_upper_constraints_url }}"
return_content: yes
register: _u_c_contents
- name: Install the python venv
include_role:
name: "python_venv_build"
vars:
venv_python_executable: "{{ horizon_venv_python_executable }}"
venv_build_constraints: "{{ _u_c_contents.content.split('\n') | reject('match', '^(horizon|pyScss)=') | list + horizon_venv_extra_constraints }}"
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_service_pip_packages | default([]) +
(horizon_enable_adjutant_ui | bool) | ternary(horizon_adjutant_optional_pip_packages, []) +
(horizon_enable_barbican_ui | bool) | ternary(horizon_barbican_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_mistral_ui | bool) | ternary(horizon_mistral_optional_pip_packages, []) +
(horizon_enable_manila_ui | bool) | ternary(horizon_manila_optional_pip_packages, []) +
(horizon_enable_masakari_ui | bool) | ternary(horizon_masakari_optional_pip_packages, []) +
(horizon_enable_murano_ui | bool) | ternary(horizon_murano_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: Find the venv's python version
find:
paths: "{{ horizon_bin | dirname }}/lib/"
patterns: "python*"
file_type: directory
recurse: no
register: _horizon_python_venv_details
tags:
- horizon-config
- name: Set python lib dir fact
set_fact:
horizon_lib_dir: "{{ _horizon_python_venv_details.files[0].path }}/dist-packages"
tags:
- horizon-config
- 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$"]
file_type: file
use_regex: yes
register: found_panels
- name: Registering policy files
find:
paths: |-
{% set policy_path = [] %}
{% for dashboard in found_dashboards.files %}
{% for path in _dashboard_panels_location %}
{% set _ = policy_path.append(dashboard.path + path) %}
{% endfor %}
{% endfor %}
{{ policy_path }}
patterns: ["^.*_policy.(json|yaml)$"]
file_type: file
use_regex: yes
register: found_policy
- name: Link policy files
file:
src: "{{ item.path }}"
dest: "{{ horizon_lib_dir }}/openstack_dashboard/conf/{{ item.path|basename }}"
state: link
with_items: "{{ found_policy.files }}"
notify:
- Compile messages
- 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