diff --git a/defaults/main.yml b/defaults/main.yml index 1c26fec8..282c346a 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -52,31 +52,17 @@ nova_git_install_branch: master nova_lxd_git_repo: https://git.openstack.org/openstack/nova-lxd nova_lxd_git_install_branch: master -nova_developer_mode: false -nova_developer_constraints: +nova_upper_constraints_url: "{{ requirements_git_url | default('https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=' ~ requirements_git_install_branch | default('master')) }}" +nova_git_constraints: - "git+{{ nova_git_repo }}@{{ nova_git_install_branch }}#egg=nova" - "git+{{ nova_lxd_git_repo }}@{{ nova_lxd_git_install_branch }}#egg=nova-lxd" - -# 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. -nova_pip_install_args: >- - {{ nova_developer_mode | ternary(pip_install_developer_constraints | default('--constraint /opt/developer-pip-constraints.txt'), '') }} - {{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''), '') }} - {{ pip_install_options | default('') }} + - "--constraint {{ nova_upper_constraints_url }}" +nova_pip_install_args: "{{ pip_install_options | default('') }}" # Name of the virtual env to deploy into nova_venv_tag: "{{ venv_tag | default('untagged') }}" nova_bin: "{{ _nova_bin }}" -# venv_download, even when true, will use the fallback method of building the -# venv from scratch if the venv download fails. -nova_venv_download: "{{ not nova_developer_mode | bool }}" -nova_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/nova.tgz - nova_fatal_deprecations: False ## Nova user information diff --git a/tasks/drivers/ironic/nova_compute_ironic.yml b/tasks/drivers/ironic/nova_compute_ironic.yml deleted file mode 100644 index 9b9dfc75..00000000 --- a/tasks/drivers/ironic/nova_compute_ironic.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -# Copyright 2016, Walmart Stores, 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: Install nova ironic packages from PIP - include_tasks: nova_compute_ironic_source.yml - when: nova_install_method == 'source' diff --git a/tasks/drivers/ironic/nova_compute_ironic_source.yml b/tasks/drivers/ironic/nova_compute_ironic_source.yml deleted file mode 100644 index 2a304462..00000000 --- a/tasks/drivers/ironic/nova_compute_ironic_source.yml +++ /dev/null @@ -1,32 +0,0 @@ ---- -# 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. - -- name: Install pip packages (venv) - pip: - name: "{{ nova_compute_ironic_pip_packages }}" - state: "{{ nova_pip_package_state }}" - virtualenv: "{{ nova_bin | dirname }}" - virtualenv_site_packages: "no" - extra_args: >- - {{ nova_developer_mode | ternary(pip_install_developer_constraints | default('--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 - tags: - - nova-install - - nova-pip-packages diff --git a/tasks/drivers/lxd/nova_compute_lxd.yml b/tasks/drivers/lxd/nova_compute_lxd.yml index 0c218f2c..8751100f 100644 --- a/tasks/drivers/lxd/nova_compute_lxd.yml +++ b/tasks/drivers/lxd/nova_compute_lxd.yml @@ -13,10 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Install nova lxd packages from PIP - include_tasks: nova_compute_lxd_source.yml - when: nova_install_method == 'source' - - name: Add nova user to lxd group user: name: "{{ nova_system_user_name }}" diff --git a/tasks/drivers/lxd/nova_compute_lxd_source.yml b/tasks/drivers/lxd/nova_compute_lxd_source.yml deleted file mode 100644 index 1baaa137..00000000 --- a/tasks/drivers/lxd/nova_compute_lxd_source.yml +++ /dev/null @@ -1,31 +0,0 @@ ---- -# 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. - -- name: Install pip packages (venv) - pip: - name: "{{ nova_compute_lxd_pip_packages }}" - state: "{{ nova_pip_package_state }}" - virtualenv: "{{ nova_bin | dirname }}" - virtualenv_site_packages: "no" - extra_args: >- - {{ nova_developer_mode | ternary(pip_install_developer_constraints | default('--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 - tags: - - nova-pip-packages diff --git a/tasks/main.yml b/tasks/main.yml index b2335326..362e762f 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -69,23 +69,23 @@ tags: - always -- include_tasks: nova_virt_detect.yml +- import_tasks: nova_virt_detect.yml when: - nova_virt_type is not defined tags: - always - nova-config -- include_tasks: nova_vgpu_detect.yml +- import_tasks: nova_vgpu_detect.yml tags: - always - nova-config -- include_tasks: nova_pre_install.yml +- import_tasks: nova_pre_install.yml tags: - nova-install -- include_tasks: nova_install.yml +- import_tasks: nova_install.yml tags: - nova-install @@ -96,11 +96,11 @@ tags: - nova-config -- include_tasks: nova_post_install.yml +- import_tasks: nova_post_install.yml tags: - nova-config -- include_tasks: nova_service_setup.yml +- import_tasks: nova_service_setup.yml when: - "nova_services['nova-conductor']['group'] in group_names" - "inventory_hostname == ((groups['nova_conductor'] | intersect(ansible_play_hosts)) | list)[0]" @@ -126,19 +126,19 @@ - common-mq - nova-config -- include_tasks: nova_db_setup.yml +- import_tasks: nova_db_setup.yml when: - "nova_services['nova-conductor']['group'] in group_names" - "inventory_hostname == ((groups['nova_conductor'] | intersect(ansible_play_hosts)) | list)[0]" tags: - nova-config -- include_tasks: nova_uwsgi.yml +- import_tasks: nova_uwsgi.yml tags: - nova-config - name: Run the systemd service role - include_role: + import_role: name: systemd_service vars: systemd_user_name: "{{ nova_system_user_name }}" @@ -170,14 +170,14 @@ - nova-config - systemd-service -- include_tasks: nova_compute.yml +- import_tasks: nova_compute.yml when: - "nova_services['nova-compute']['group'] in group_names" tags: - nova-compute - name: Include ceph_client role - include_role: + import_role: name: ceph_client vars: openstack_service_system_user: "{{ nova_system_user_name }}" diff --git a/tasks/nova_compute.yml b/tasks/nova_compute.yml index 09c01804..c9835472 100644 --- a/tasks/nova_compute.yml +++ b/tasks/nova_compute.yml @@ -14,6 +14,8 @@ # limitations under the License. - include_tasks: "drivers/{{ nova_virt_type }}/nova_compute_{{ nova_virt_type }}.yml" + when: + - nova_virt_type != 'ironic' tags: - nova-install diff --git a/tasks/nova_install.yml b/tasks/nova_install.yml index 1d60b85b..b35df5de 100644 --- a/tasks/nova_install.yml +++ b/tasks/nova_install.yml @@ -45,8 +45,26 @@ tags: - nova-pip-packages -- name: Install nova packages from PIP - include_tasks: nova_install_source.yml +- name: Install the python venv + import_role: + name: "python_venv_build" + vars: + venv_build_constraints: "{{ nova_git_constraints }}" + venv_build_distro_package_list: "{{ nova_devel_distro_packages }}" + venv_install_destination_path: "{{ nova_bin | dirname }}" + venv_pip_install_args: "{{ nova_pip_install_args }}" + venv_packages_to_symlink: "{{ (nova_services['nova-compute']['group'] in group_names) | ternary(nova_compute_kvm_packages_to_symlink, []) }}" + venv_pip_packages: "{{ nova_venv_packages }}" + venv_facts_when_changed: + - section: "nova" + option: "need_service_restart" + value: "True" + - section: "nova" + option: "need_online_data_migrations" + value: "True" + - section: "nova" + option: "venv_tag" + value: "{{ nova_venv_tag }}" when: nova_install_method == 'source' - include_tasks: "consoles/nova_console_{{ nova_console_type }}_install.yml" diff --git a/tasks/nova_install_source.yml b/tasks/nova_install_source.yml deleted file mode 100644 index c2f25b2e..00000000 --- a/tasks/nova_install_source.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -# 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. - -# 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 nova_developer_constraints %} - {{ item }} - {% endfor %} - when: - - nova_developer_mode | bool - -- name: Ensure remote wheel building is disabled in developer mode - set_fact: - venv_build_host: "{{ inventory_hostname }}" - when: - - nova_developer_mode | bool - -- name: Install the python venv - include_role: - name: "python_venv_build" - vars: - venv_build_distro_package_list: "{{ nova_devel_distro_packages }}" - venv_install_destination_path: "{{ nova_bin | dirname }}" - venv_pip_install_args: "{{ nova_pip_install_args }}" - venv_packages_to_symlink: "{{ (nova_services['nova-compute']['group'] in group_names) | ternary(nova_compute_kvm_packages_to_symlink, []) }}" - venv_pip_packages: >- - {{ nova_pip_packages | union(nova_user_pip_packages) + - ((nova_services['nova-novncproxy']['group'] in group_names) and (nova_console_type == 'novnc')) | ternary(nova_novnc_pip_packages, []) + - (nova_oslomsg_amqp1_enabled | bool) | ternary(nova_optional_oslomsg_amqp1_pip_packages, []) }} - venv_facts_when_changed: - - section: "nova" - option: "need_service_restart" - value: "True" - - section: "nova" - option: "need_online_data_migrations" - value: "True" - - section: "nova" - option: "venv_tag" - value: "{{ nova_venv_tag }}" diff --git a/vars/main.yml b/vars/main.yml index 568ed9ba..203b77c6 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -13,6 +13,24 @@ # See the License for the specific language governing permissions and # limitations under the License. +nova_venv_packages: |- + {%- set pkg_list = nova_pip_packages | union(nova_user_pip_packages) %} + {%- if nova_oslomsg_amqp1_enabled | bool %} + {%- set _ = pkg_list.extend(nova_optional_oslomsg_amqp1_pip_packages) %} + {%- endif %} + {%- if (nova_services['nova-novncproxy']['group'] in group_names) and + (nova_console_type == 'novnc') %} + {%- set _ = pkg_list.extend(nova_novnc_pip_packages) %} + {%- endif %} + {%- if (nova_services['nova-compute']['group'] in group_names) %} + {%- if nova_virt_type == 'lxd' %} + {%- set _ = pkg_list.extend(nova_compute_lxd_pip_packages) %} + {%- elif nova_virt_type == 'ironic' %} + {%- set _ = pkg_list.extend(nova_compute_ironic_pip_packages) %} + {%- endif %} + {%- endif %} + {{- pkg_list | unique }} + # # Compile a list of the services on a host based on whether # the host is in the host group and the service is enabled.