--- # 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: "{{ ansible_hostname }}" when: - horizon_developer_mode | bool - name: Install the python venv include_role: name: "python_venv_build" private: yes vars: venv_build_distro_package_list: "{{ horizon_devel_distro_packages }}" venv_install_destination_path: "{{ horizon_bin | dirname }}" venv_install_distro_package_list: "{{ horizon_distro_packages }}" venv_pip_install_args: "{{ horizon_pip_install_args }}" venv_pip_packages: "{{ horizon_pip_packages + horizon_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 # 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