openstack-ansible-os_horizon/tasks/horizon_install_source.yml
Mohammed Naser b647643db7 Copy over YAML policy files
There are some projects (such as Octavia) that ship YAML policy
files such as Octavia so this patch copies them as well.

Change-Id: Ic78d130bb3899720f619d8a78155c7b36807a07c
2019-03-30 19:27:40 -04:00

151 lines
6.0 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']
- name: Install the python venv
include_role:
name: "python_venv_build"
vars:
venv_build_constraints: "{{ horizon_git_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_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_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$"]
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