diff --git a/defaults/main.yml b/defaults/main.yml index bc03634a..c7bc114c 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -26,6 +26,9 @@ horizon_service_setup_host: "{{ openstack_service_setup_host | default('localhos horizon_package_state: "latest" horizon_pip_package_state: "latest" +# Set installation method. +horizon_install_method: "source" + ## Toggle developer mode horizon_developer_mode: false @@ -63,7 +66,7 @@ horizon_developer_constraints: # Name of the virtual env to deploy into horizon_venv_tag: untagged -horizon_bin: "/openstack/venvs/horizon-{{ horizon_venv_tag }}/bin" +horizon_bin: "{{ _horizon_bin }}" # venv_download, even when true, will use the fallback method of building the # venv from scratch if the venv download fails. @@ -99,7 +102,7 @@ horizon_session_timeout: 1800 horizon_help_url: http://docs.openstack.org ## Installation directories -horizon_lib_dir: "{{ horizon_bin | dirname }}/lib/python2.7/dist-packages" +horizon_lib_dir: "{{ _horizon_lib_dir }}" horizon_lib_wsgi_file: "{{ horizon_lib_dir }}/openstack_dashboard/wsgi/django.wsgi" horizon_endpoint_type: internalURL diff --git a/releasenotes/notes/openstack-distribution-packages-bbec587237b8bc80.yaml b/releasenotes/notes/openstack-distribution-packages-bbec587237b8bc80.yaml new file mode 100644 index 00000000..dca0d734 --- /dev/null +++ b/releasenotes/notes/openstack-distribution-packages-bbec587237b8bc80.yaml @@ -0,0 +1,7 @@ +--- +features: + - | + The role now supports using the distribution packages for the OpenStack + services instead of the pip ones. This feature is disabled by default + and can be enabled by simply setting the ``nova_install_method`` + variable to ``distro``. diff --git a/tasks/horizon_db_setup.yml b/tasks/horizon_db_setup.yml index e2723479..2a6a61ab 100644 --- a/tasks/horizon_db_setup.yml +++ b/tasks/horizon_db_setup.yml @@ -40,7 +40,7 @@ no_log: True - name: Perform a horizon DB sync - command: "{{ horizon_bin }}/horizon-manage.py migrate --noinput" + command: "{{ horizon_manage }} migrate --noinput" become: yes become_user: "{{ horizon_system_user_name }}" changed_when: false @@ -50,6 +50,6 @@ name: "Clear out expired sessions" minute: "{{ 58 | random(start=2) }}" hour: 21 - job: "{{ horizon_bin }}/horizon-manage.py clearsessions" + job: "{{ horizon_manage }} clearsessions" user: "{{ horizon_system_user_name }}" state: present diff --git a/tasks/horizon_install.yml b/tasks/horizon_install.yml index 340745a7..ea3866d2 100644 --- a/tasks/horizon_install.yml +++ b/tasks/horizon_install.yml @@ -37,9 +37,21 @@ - { src: "/var/log/httpd", dest: "/var/log/apache2" } when: ansible_pkg_mgr in ['yum', 'dnf'] +- name: Record the installation method + ini_file: + dest: "/etc/ansible/facts.d/openstack_ansible.fact" + section: "horizon" + option: "install_method" + value: "{{ horizon_install_method }}" + +- name: Refresh local facts to ensure the horizon section is present + setup: + filter: ansible_local + gather_subset: "!all" + - name: Install distro packages package: - name: "{{ horizon_distro_packages }}" + 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) }}" @@ -48,139 +60,6 @@ retries: 5 delay: 2 -- 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: Retrieve checksum for venv download - uri: - url: "{{ horizon_venv_download_url | replace('tgz', 'checksum') }}" - return_content: yes - register: horizon_venv_checksum - when: horizon_venv_download | bool - -- name: Attempt venv download - get_url: - url: "{{ horizon_venv_download_url }}" - dest: "/var/cache/{{ horizon_venv_download_url | basename }}" - checksum: "sha1:{{ horizon_venv_checksum.content | trim }}" - register: horizon_get_venv - retries: 5 - delay: 5 - until: horizon_get_venv is succeeded - when: horizon_venv_download | bool - -- name: Remove existing venv - file: - path: "{{ horizon_bin | dirname }}" - state: absent - when: horizon_get_venv is changed - -- name: Create horizon venv dir - file: - path: "{{ horizon_bin | dirname }}" - state: directory - mode: "0755" - register: horizon_venv_dir - when: horizon_get_venv is changed - -- name: Unarchive pre-built venv - unarchive: - src: "/var/cache/{{ horizon_venv_download_url | basename }}" - dest: "{{ horizon_bin | dirname }}" - copy: "no" - when: horizon_get_venv is changed - notify: Restart apache2 - -- name: Install pip packages - pip: - name: "{{ horizon_pip_packages }}" - state: "{{ horizon_pip_package_state }}" - virtualenv: "{{ horizon_bin | dirname }}" - virtualenv_site_packages: "no" - extra_args: >- - {{ horizon_developer_mode | ternary('--constraint /opt/developer-pip-constraints.txt', '') }} - {{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''),'') }} - {{ pip_install_options | default('') }} - register: install_packages - until: install_packages is success - retries: 5 - delay: 2 - when: horizon_get_venv | failed or horizon_get_venv | skipped - notify: Restart apache2 - -- name: Install optional pip packages - pip: - name: "{{ horizon_optional_pip_packages }}" - state: "{{ horizon_pip_package_state }}" - virtualenv: "{{ horizon_bin | dirname }}" - virtualenv_site_packages: "no" - extra_args: >- - {{ horizon_developer_mode | ternary('--constraint /opt/developer-pip-constraints.txt', '') }} - {{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''),'') }} - {{ pip_install_options | default('') }} - register: install_packages - until: install_packages is success - retries: 5 - delay: 2 - when: horizon_optional_pip_packages | length > 0 - -- name: Remove python from path first (CentOS, openSUSE) - file: - path: "{{ horizon_bin | dirname }}/bin/python2.7" - state: "absent" - when: - - ansible_pkg_mgr in ['yum', 'dnf', 'zypper'] - - horizon_get_venv is changed - -# NOTE(odyssey4me): -# We reinitialize the venv to ensure that the right -# version of python is in the venv, but we do not -# want virtualenv to also replace pip, setuptools -# and wheel so we tell it not to. -# We do not use --always-copy for CentOS/SuSE due -# to https://github.com/pypa/virtualenv/issues/565 -- name: Update virtualenv path - shell: | - find {{ horizon_bin }} -name \*.pyc -delete - sed -si '1s/^.*python.*$/#!{{ horizon_bin | replace ('/','\/') }}\/python/' {{ horizon_bin }}/* - virtualenv {{ horizon_bin | dirname }} \ - {{ (ansible_pkg_mgr == 'apt') | ternary('--always-copy', '') }} \ - --no-pip \ - --no-setuptools \ - --no-wheel - when: horizon_get_venv is changed - tags: - - skip_ansible_lint - -- 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: Record the venv tag deployed - ini_file: - dest: "/etc/ansible/facts.d/openstack_ansible.fact" - section: horizon - option: venv_tag - value: "{{ horizon_venv_tag }}" +- name: Install horizon packages from PIP + include_tasks: horizon_install_source.yml + when: horizon_install_method == 'source' diff --git a/tasks/horizon_install_source.yml b/tasks/horizon_install_source.yml new file mode 100644 index 00000000..54798dc7 --- /dev/null +++ b/tasks/horizon_install_source.yml @@ -0,0 +1,175 @@ +--- +# 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: 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: Retrieve checksum for venv download + uri: + url: "{{ horizon_venv_download_url | replace('tgz', 'checksum') }}" + return_content: yes + register: horizon_venv_checksum + when: horizon_venv_download | bool + +- name: Attempt venv download + get_url: + url: "{{ horizon_venv_download_url }}" + dest: "/var/cache/{{ horizon_venv_download_url | basename }}" + checksum: "sha1:{{ horizon_venv_checksum.content | trim }}" + register: horizon_get_venv + retries: 5 + delay: 5 + until: horizon_get_venv is succeeded + when: horizon_venv_download | bool + +- name: Remove existing venv + file: + path: "{{ horizon_bin | dirname }}" + state: absent + when: horizon_get_venv is changed + +- name: Create horizon venv dir + file: + path: "{{ horizon_bin | dirname }}" + state: directory + mode: "0755" + register: horizon_venv_dir + when: horizon_get_venv is changed + +- name: Unarchive pre-built venv + unarchive: + src: "/var/cache/{{ horizon_venv_download_url | basename }}" + dest: "{{ horizon_bin | dirname }}" + copy: "no" + when: horizon_get_venv is changed + notify: Restart apache2 + +- name: Install pip packages + pip: + name: "{{ horizon_pip_packages }}" + state: "{{ horizon_pip_package_state }}" + virtualenv: "{{ horizon_bin | dirname }}" + virtualenv_site_packages: "no" + extra_args: >- + {{ horizon_developer_mode | ternary('--constraint /opt/developer-pip-constraints.txt', '') }} + {{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''),'') }} + {{ pip_install_options | default('') }} + register: install_packages + until: install_packages|success + retries: 5 + delay: 2 + when: horizon_get_venv is failed or horizon_get_venv is skipped + notify: Restart apache2 + +- name: Install optional pip packages + pip: + name: "{{ horizon_optional_pip_packages }}" + state: "{{ horizon_pip_package_state }}" + virtualenv: "{{ horizon_bin | dirname }}" + virtualenv_site_packages: "no" + extra_args: >- + {{ horizon_developer_mode | ternary('--constraint /opt/developer-pip-constraints.txt', '') }} + {{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''),'') }} + {{ pip_install_options | default('') }} + register: install_packages + until: install_packages|success + retries: 5 + delay: 2 + when: horizon_optional_pip_packages | length > 0 + +- name: Remove python from path first (CentOS, openSUSE) + file: + path: "{{ horizon_bin | dirname }}/bin/python2.7" + state: "absent" + when: + - ansible_pkg_mgr in ['yum', 'dnf', 'zypper'] + - horizon_get_venv is changed + +# NOTE(odyssey4me): +# We reinitialize the venv to ensure that the right +# version of python is in the venv, but we do not +# want virtualenv to also replace pip, setuptools +# and wheel so we tell it not to. +# We do not use --always-copy for CentOS/SuSE due +# to https://github.com/pypa/virtualenv/issues/565 +- name: Update virtualenv path + shell: | + find {{ horizon_bin }} -name \*.pyc -delete + sed -si '1s/^.*python.*$/#!{{ horizon_bin | replace ('/','\/') }}\/python/' {{ horizon_bin }}/* + virtualenv {{ horizon_bin | dirname }} \ + {{ (ansible_pkg_mgr == 'apt') | ternary('--always-copy', '') }} \ + --no-pip \ + --no-setuptools \ + --no-wheel + when: horizon_get_venv is changed + tags: + - skip_ansible_lint + +- 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: Record the venv tag deployed + ini_file: + dest: "/etc/ansible/facts.d/openstack_ansible.fact" + section: horizon + option: venv_tag + value: "{{ horizon_venv_tag }}" diff --git a/tasks/horizon_post_install.yml b/tasks/horizon_post_install.yml index 2348253c..84a0e4fb 100644 --- a/tasks/horizon_post_install.yml +++ b/tasks/horizon_post_install.yml @@ -13,15 +13,21 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Ensure horizon local dir is accessible by user +- name: Ensure horizon dirs are accessible by user file: - path: "{{ horizon_lib_dir }}" + path: "{{ item.path }}" state: directory owner: "{{ horizon_system_user_name }}" group: "{{ horizon_system_group_name }}" mode: "0755" recurse: yes + with_items: + - { path: "{{ horizon_lib_dir }}", fixup: True } + - { path: "/etc/openstack-dashboard", fixup: "{{ (ansible_os_family | lower) == 'redhat' }}" } + when: item.fixup +# TODO(hwoarang): See if we can use local_settings.py from the distribution packages +# when horizon_install_method == 'distro' - name: Setup Horizon config(s) template: src: "{{ item.src }}" @@ -30,9 +36,10 @@ group: "{{ horizon_system_group_name }}" mode: "{{ item.mode }}" with_items: - - { src: "horizon_local_settings.py.j2", dest: "/etc/horizon/local_settings.py", owner: "root", mode: "0640" } - - { src: "horizon-manage.py.j2", dest: "{{ horizon_bin }}/horizon-manage.py", mode: "0755" } - - { src: "80_admin_default_panel.py.j2", dest: "{{ horizon_lib_dir }}/openstack_dashboard/local/enabled/_80_admin_default_panel.py", mode: "0755" } + - { src: "horizon_local_settings.py.j2", dest: "/etc/horizon/local_settings.py", owner: "root", mode: "0640", always_install: True } + - { src: "horizon-manage.py.j2", dest: "{{ horizon_bin }}/horizon-manage.py", mode: "0755", always_install: "{{ (horizon_install_method == 'source') }}" } + - { src: "80_admin_default_panel.py.j2", dest: "{{ horizon_lib_dir }}/openstack_dashboard/local/enabled/_80_admin_default_panel.py", mode: "0755", always_install: True } + when: item.always_install notify: Restart apache2 - name: Uploading horizon custom files @@ -90,15 +97,15 @@ when: horizon_customization_module is defined - name: Compile messages for translation - command: "{{ horizon_bin }}/horizon-manage.py compilemessages" + command: "{{ horizon_manage }} compilemessages" become: yes become_user: "{{ horizon_system_user_name }}" args: - chdir: "{{ horizon_lib_dir }}/{{ item }}" + chdir: "{{ item }}" changed_when: false with_items: - - horizon - - openstack_dashboard + - "{{ horizon_python_lib_dir }}/horizon" + - "{{ horizon_lib_dir }}/openstack_dashboard" register: async_compile_messages async: 600 poll: 0 @@ -109,8 +116,8 @@ become_user: "{{ horizon_system_user_name }}" changed_when: false with_items: - - "{{ horizon_bin }}/horizon-manage.py collectstatic --noinput" - - "{{ horizon_bin }}/horizon-manage.py compress --force" + - "{{ horizon_manage }} collectstatic --noinput" + - "{{ horizon_manage }} compress --force" notify: Restart apache2 register: async_compress_static_files async: 600 diff --git a/tasks/main.yml b/tasks/main.yml index 5d577649..8a1ea800 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -24,6 +24,21 @@ tags: - always +- name: Fail if service was deployed using a different installation method + fail: + msg: "Switching installation methods for OpenStack services is not supported" + when: + - ansible_local is defined + - ansible_local.openstack_ansible is defined + - ansible_local.openstack_ansible.horizon is defined + - ansible_local.openstack_ansible.horizon.install_method is defined + - ansible_local.openstack_ansible.horizon.install_method != horizon_install_method + +- name: Gather variables for installation method + include_vars: "{{ horizon_install_method }}_install.yml" + tags: + - always + - include: horizon_pre_install.yml tags: - horizon-install diff --git a/templates/horizon_local_settings.py.j2 b/templates/horizon_local_settings.py.j2 index b615743b..ae71ca74 100644 --- a/templates/horizon_local_settings.py.j2 +++ b/templates/horizon_local_settings.py.j2 @@ -443,8 +443,15 @@ ENFORCE_PASSWORD_CHECK = {{ horizon_enforce_password_check }} # OpenStack services are using to determine role based access control in the # target installation. +# Path to directory containing policy.json files +{% if horizon_install_method == 'distro' and (ansible_os_family | lower) == 'redhat' %} +# CentOS has policy files in /etc/openstack-dashboard +POLICY_FILES_PATH = '/etc/openstack-dashboard' +{% else %} # Path to directory containing policy.json files #POLICY_FILES_PATH = os.path.join(ROOT_PATH, "conf") +{% endif %} + # Map of local copy of service policy files. # Please insure that your identity policy file matches the one being used on # your keystone servers. There is an alternate policy file that may be used diff --git a/tox.ini b/tox.ini index 021217c7..f59caa5c 100644 --- a/tox.ini +++ b/tox.ini @@ -85,6 +85,12 @@ commands = commands = bash -c "{toxinidir}/tests/common/test-ansible-functional.sh" +[testenv:distro_install] +setenv = + {[testenv]setenv} + ANSIBLE_PARAMETERS=-e @{toxinidir}/tests/common/test-distro_install-vars.yml +commands = + bash -c "{toxinidir}/tests/common/test-ansible-functional.sh" [testenv:ssl] setenv = diff --git a/vars/debian.yml b/vars/debian.yml index cdb9f842..a890f2fe 100644 --- a/vars/debian.yml +++ b/vars/debian.yml @@ -18,18 +18,27 @@ cache_timeout: 600 horizon_system_service_name: apache2 -horizon_distro_packages: - - apache2 - - apache2-utils - - cron # required by the Ansible cron module +horizon_devel_distro_packages: - git - - libapache2-mod-wsgi - libmariadbclient-dev # required to build MySQL-python - libssl-dev - libxslt1.1 - openssl - - python-mysqldb # required by the Ansible mysql_db module + +horizon_distro_packages: + - apache2 + - apache2-utils + - cron # required by the Ansible cron module - gettext + - libapache2-mod-wsgi + - python-mysqldb # required by the Ansible mysql_db module + +horizon_service_distro_packages: + - openstack-dashboard + - python-django-openstack-auth + - python-django-horizon + - python-memcache + - python-pymysql horizon_apache_conf: "/etc/apache2/apache2.conf" horizon_apache_default_log_folder: "/var/log/apache2" @@ -46,6 +55,7 @@ horizon_apache_configs: horizon_apache_default_sites: - "/etc/apache2/sites-enabled/000-default.conf" + - "/etc/apache2/conf-enabled/openstack-dashboard.conf" horizon_apache_modules: - name: "wsgi" @@ -60,3 +70,7 @@ horizon_apache_modules: state: "present" - name: "headers" state: "present" + +_horizon_lib_dir: "/usr/share/openstack-dashboard" +horizon_python_lib_dir: "/usr/lib/python2.7/dist-packages" +horizon_dashboard_panel_dir: "{{ _horizon_lib_dir }}/openstack_dashboard/local/enabled" diff --git a/vars/distro_install.yml b/vars/distro_install.yml new file mode 100644 index 00000000..f18ce983 --- /dev/null +++ b/vars/distro_install.yml @@ -0,0 +1,22 @@ +--- +# Copyright 2018, SUSE LINUX GmbH. +# +# 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. + +horizon_package_list: "{{ horizon_distro_packages + horizon_service_distro_packages }}" + +_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 4d9bda75..e22825fc 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -15,98 +15,98 @@ _horizon_panels: - src: "{{ horizon_lib_dir }}/heat_dashboard/enabled/_1610_project_orchestration_panel.py" - path: "{{ horizon_lib_dir }}/openstack_dashboard/local/enabled/_1610_project_orchestration_panel.py" - state: "{{ horizon_enable_heat_ui | ternary('link', 'absent') }}" + 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_lib_dir }}/openstack_dashboard/local/enabled/_1620_project_stacks_panel.py" - state: "{{ horizon_enable_heat_ui | ternary('link', 'absent') }}" + 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_lib_dir }}/openstack_dashboard/local/enabled/_1630_project_resource_types_panel.py" - state: "{{ horizon_enable_heat_ui | ternary('link', 'absent') }}" + 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_lib_dir }}/openstack_dashboard/local/enabled/_1640_project_template_versions_panel.py" - state: "{{ horizon_enable_heat_ui | ternary('link', 'absent') }}" + 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_lib_dir }}/openstack_dashboard/local/enabled/_1650_project_template_generator_panel.py" - state: "{{ horizon_enable_heat_ui | ternary('link', 'absent') }}" + 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('link', 'absent') }}" + 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('link', 'absent') }}" + 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_lib_dir }}/openstack_dashboard/local/enabled/_1710_project_dns_panel_group.py" - state: "{{ horizon_enable_designate_ui | ternary('link', 'absent') }}" + 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_lib_dir }}/openstack_dashboard/local/enabled/_1720_project_dns_panel.py" - state: "{{ horizon_enable_designate_ui | ternary('link', 'absent') }}" + 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_lib_dir }}/openstack_dashboard/local/enabled/_1721_dns_zones_panel.py" - state: "{{ horizon_enable_designate_ui | ternary('link', 'absent') }}" + 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_lib_dir }}/openstack_dashboard/local/enabled/_1722_dns_reversedns_panel.py" - state: "{{ horizon_enable_designate_ui | ternary('link', 'absent') }}" + 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_lib_dir }}/openstack_dashboard/local/enabled/_2200_ironic.py" - state: "{{ horizon_enable_ironic_ui | ternary('link', 'absent') }}" + 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_lib_dir }}/openstack_dashboard/local/enabled/_1370_project_container_infra_panel_group.py" - state: "{{ horizon_enable_magnum_ui | ternary('link', 'absent') }}" + 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_lib_dir }}/openstack_dashboard/local/enabled/_1371_project_container_infra_clusters_panel.py" - state: "{{ horizon_enable_magnum_ui | ternary('link', 'absent') }}" + 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_lib_dir }}/openstack_dashboard/local/enabled/_1372_project_container_infra_cluster_templates_panel.py" - state: "{{ horizon_enable_magnum_ui | ternary('link', 'absent') }}" + 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_lib_dir }}/openstack_dashboard/enabled/_1810_data_processing_panel_group.py" - state: "{{ horizon_enable_sahara_ui | ternary('link', 'absent') }}" + 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_lib_dir }}/openstack_dashboard/enabled/_1820_data_processing_clusters_panel.py" - state: "{{ horizon_enable_sahara_ui | ternary('link', 'absent') }}" + 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_lib_dir }}/openstack_dashboard/enabled/_1830_data_processing_plugins_panel.py" - state: "{{ horizon_enable_sahara_ui | ternary('link', 'absent') }}" + 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_lib_dir }}/openstack_dashboard/enabled/_1840_data_processing_jobs_panel.py" - state: "{{ horizon_enable_sahara_ui | ternary('link', 'absent') }}" + 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('link', 'absent') }}" + 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_lib_dir }}/openstack_dashboard/enabled/_1710_database_panel_group.py" - state: "{{ horizon_enable_trove_ui | ternary('link', 'absent') }}" + 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_lib_dir }}/openstack_dashboard/enabled/_1720_project_databases_panel.py" - state: "{{ horizon_enable_trove_ui | ternary('link', 'absent') }}" + 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_lib_dir }}/openstack_dashboard/enabled/_1730_project_database_backups_panel.py" - state: "{{ horizon_enable_trove_ui | ternary('link', 'absent') }}" + 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_lib_dir }}/openstack_dashboard/enabled/_1731_project_database_backups_panel.py" - state: "{{ horizon_enable_trove_ui | ternary('link', 'absent') }}" + 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_lib_dir }}/openstack_dashboard/enabled/_1740_project_database_clusters_panel.py" - state: "{{ horizon_enable_trove_ui | ternary('link', 'absent') }}" + 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_lib_dir }}/openstack_dashboard/enabled/_1760_project_database_configurations_panel.py" - state: "{{ horizon_enable_trove_ui | ternary('link', 'absent') }}" + 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_lib_dir }}/openstack_dashboard/local/enabled/_1481_project_ng_loadbalancersv2_panel.py" - state: "{{ (horizon_enable_neutron_lbaas | bool) | ternary('link', 'absent') }}" + 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_lib_dir }}/openstack_dashboard/local/enabled/_7010_project_firewalls_common.py" - state: "{{ (horizon_enable_neutron_fwaas | bool) | ternary('link', 'absent') }}" + 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_lib_dir }}/openstack_dashboard/local/enabled/_7011_project_firewalls_panel.py" - state: "{{ (horizon_enable_neutron_fwaas | bool) | ternary('link', 'absent') }}" + 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_lib_dir }}/openstack_dashboard/local/enabled/_7012_project_firewalls_v2_panel.py" - state: "{{ (horizon_enable_neutron_fwaas | bool) | ternary('link', 'absent') }}" + 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_lib_dir }}/openstack_dashboard/local/enabled/_1482_project_load_balancer_panel.py" - state: "{{ (horizon_enable_octavia_ui | bool) | ternary('link', 'absent') }}" + 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" diff --git a/vars/redhat-7.yml b/vars/redhat-7.yml index a9f2acfd..dcc93bf9 100644 --- a/vars/redhat-7.yml +++ b/vars/redhat-7.yml @@ -15,22 +15,37 @@ horizon_system_service_name: httpd +horizon_devel_distro_packages: + - git + - libxslt-devel + - openssl + - openssl-libs + horizon_distro_packages: - cronie - cronie-anacron - gettext - - git - httpd - httpd-tools - - libxslt-devel - mod_ssl - mod_wsgi - MySQL-python - - openssl - - openssl-libs - which - MariaDB-devel # required to build MySQL-python +horizon_service_distro_packages: + - openstack-designate-ui + - openstack-heat-ui + - openstack-ironic-ui + - openstack-magnum-ui + - openstack-manila-ui + - openstack-neutron-lbaas-ui + - openstack-sahara-ui + - openstack-trove-ui + - openstack-octavia-ui + - python-django-horizon + - python-memcached + horizon_apache_conf: "/etc/httpd/conf/httpd.conf" horizon_apache_default_log_folder: "/var/log/httpd" horizon_apache_default_log_owner: "root" @@ -45,3 +60,7 @@ horizon_apache_default_sites: - "/etc/httpd/conf.d/userdir.conf" - "/etc/httpd/conf.d/welcome.conf" - "/etc/httpd/conf.d/ssl.conf" + +_horizon_lib_dir: "/usr/share/openstack-dashboard" +horizon_python_lib_dir: "/usr/lib/python2.7/site-packages" +horizon_dashboard_panel_dir: "{{ _horizon_lib_dir }}/openstack_dashboard/local/enabled" diff --git a/vars/source_install.yml b/vars/source_install.yml new file mode 100644 index 00000000..4522b375 --- /dev/null +++ b/vars/source_install.yml @@ -0,0 +1,21 @@ +--- +# Copyright 2018, SUSE LINUX GmbH. +# +# 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. +horizon_package_list: "{{ horizon_distro_packages + horizon_devel_distro_packages }}" +_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" diff --git a/vars/suse-42.yml b/vars/suse-42.yml index 4257c782..1aec4af8 100644 --- a/vars/suse-42.yml +++ b/vars/suse-42.yml @@ -15,21 +15,43 @@ horizon_system_service_name: apache2 +horizon_devel_distro_packages: + - git-core + - libxslt-devel + - openssl + - libopenssl-devel + horizon_distro_packages: + - apache2 + - apache2-utils + - apache2-mod_wsgi - cronie - cronie-anacron - gettext - - git-core - - apache2 - - apache2-utils - - libxslt-devel - - apache2-mod_wsgi - python-MySQL-python - - openssl - - libopenssl-devel - which - MariaDB-devel # required to build MySQL-python +horizon_service_distro_packages: + - openstack-horizon-plugin-designate-ui + - openstack-horizon-plugin-gbp-ui + - openstack-horizon-plugin-ironic-ui + - openstack-horizon-plugin-magnum-ui + - openstack-horizon-plugin-manila-ui + - openstack-horizon-plugin-monasca-ui + - openstack-horizon-plugin-neutron-fwaas-ui + - openstack-horizon-plugin-neutron-lbaas-ui + - openstack-horizon-plugin-neutron-vpnaas-ui + - openstack-horizon-plugin-sahara-ui + - openstack-horizon-plugin-trove-ui + - python-horizon + - python-memcached + +# SUSE does not currently have packages for the following dashboards +horizon_enable_heat_ui: False +horizon_enable_octavia_ui: False +horizon_enable_designate_ui: False # SUSE package is missing _1721_dns_zones_panel.py and _1722_dns_reversedns_panel.py + horizon_apache_conf: "/etc/apache2/httpd.conf" horizon_apache_default_log_folder: "/var/log/apache2" horizon_apache_default_log_owner: "root" @@ -58,3 +80,7 @@ horizon_apache_modules: state: "present" - name: "headers" state: "present" + +_horizon_lib_dir: "/srv/www/openstack-dashboard" +horizon_python_lib_dir: "/usr/lib/python2.7/site-packages" +horizon_dashboard_panel_dir: "{{ _horizon_lib_dir }}/openstack_dashboard/enabled" diff --git a/zuul.d/project.yaml b/zuul.d/project.yaml index 62d48274..de03fcf7 100644 --- a/zuul.d/project.yaml +++ b/zuul.d/project.yaml @@ -18,4 +18,12 @@ - openstack-ansible-role-jobs check: jobs: + - openstack-ansible-functional-distro_install-centos-7 + - openstack-ansible-functional-distro_install-opensuse-423 + - openstack-ansible-functional-distro_install-ubuntu-xenial - openstack-ansible-horizon-ssl-nv + gate: + jobs: + - openstack-ansible-functional-distro_install-centos-7 + - openstack-ansible-functional-distro_install-opensuse-423 + - openstack-ansible-functional-distro_install-ubuntu-xenial