diff --git a/defaults/main.yml b/defaults/main.yml index f827ec9d..be841a03 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -75,9 +75,8 @@ openstack_ceilometer_git_install_branch: master networking_ovn_git_repo: https://git.openstack.org/openstack/networking-ovn networking_ovn_git_install_branch: master -# Developer mode -neutron_developer_mode: false -neutron_developer_constraints: +neutron_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')) }}" +neutron_git_constraints: - "git+{{ neutron_git_repo }}@{{ neutron_git_install_branch }}#egg=neutron" - "git+{{ neutron_fwaas_git_repo }}@{{ neutron_fwaas_git_install_branch }}#egg=neutron-fwaas" - "git+{{ neutron_lbaas_git_repo }}@{{ neutron_lbaas_git_install_branch }}#egg=neutron-lbaas" @@ -89,25 +88,13 @@ neutron_developer_constraints: - "git+{{ networking_bgpvpn_git_repo }}@{{ networking_bgpvpn_git_install_branch }}#egg=networking-bgpvpn" - "git+{{ openstack_ceilometer_git_repo }}@{{ openstack_ceilometer_git_install_branch }}#egg=ceilometer" - "git+{{ networking_ovn_git_repo }}@{{ networking_ovn_git_install_branch }}#egg=networking-ovn" + - "--constraint {{ neutron_upper_constraints_url }}" -# 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. -neutron_pip_install_args: >- - {{ neutron_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('') }} +neutron_pip_install_args: "{{ pip_install_options | default('') }}" # Name of the virtual env to deploy into neutron_venv_tag: "{{ venv_tag | default('untagged') }}" -# venv_download, even when true, will use the fallback method of building the -# venv from scratch if the venv download fails. -neutron_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/neutron.tgz - ### ### Generic Neutron Config ### diff --git a/tasks/main.yml b/tasks/main.yml index 220f3e13..d636224b 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -90,7 +90,7 @@ - neutron-config - name: Run the systemd service role - include_role: + import_role: name: systemd_service vars: systemd_user_name: "{{ neutron_system_user_name }}" diff --git a/tasks/neutron_install.yml b/tasks/neutron_install.yml index 84c4d62b..0e20f5c2 100644 --- a/tasks/neutron_install.yml +++ b/tasks/neutron_install.yml @@ -46,8 +46,25 @@ delay: 2 with_items: "{{ neutron_remove_distro_packages }}" -- name: Install neutron packages from PIP - import_tasks: neutron_install_source.yml +- name: Install the python venv + import_role: + name: "python_venv_build" + vars: + venv_build_constraints: "{{ neutron_git_constraints }}" + venv_install_destination_path: "{{ neutron_bin | dirname }}" + venv_install_distro_package_list: "{{ neutron_package_list }}" + venv_pip_install_args: "{{ neutron_pip_install_args }}" + venv_pip_packages: "{{ neutron_venv_packages }}" + venv_facts_when_changed: + - section: "neutron" + option: "need_db_expand" + value: "True" + - section: "neutron" + option: "need_db_contract" + value: "True" + - section: "neutron" + option: "venv_tag" + value: "{{ neutron_venv_tag }}" when: neutron_install_method == 'source' - name: Initialise the upgrade facts diff --git a/tasks/neutron_install_source.yml b/tasks/neutron_install_source.yml deleted file mode 100644 index 043fbb98..00000000 --- a/tasks/neutron_install_source.yml +++ /dev/null @@ -1,62 +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 neutron_developer_constraints %} - {{ item }} - {% endfor %} - when: neutron_developer_mode | bool - -- name: Ensure remote wheel building is disabled in developer mode - set_fact: - venv_build_host: "{{ inventory_hostname }}" - when: - - neutron_developer_mode | bool - -- name: Install the python venv - include_role: - name: "python_venv_build" - vars: - venv_install_destination_path: "{{ neutron_bin | dirname }}" - venv_install_distro_package_list: "{{ neutron_package_list }}" - venv_pip_install_args: "{{ neutron_pip_install_args }}" - venv_pip_packages: >- - {{ neutron_pip_packages | union(neutron_user_pip_packages) + - (neutron_bgp | bool) | ternary(neutron_optional_bgp_pip_packages, []) + - (neutron_fwaas | bool) | ternary(neutron_optional_fwaas_pip_packages, []) + - (neutron_fwaas_v2 | bool) | ternary(neutron_optional_fwaas_pip_packages, []) + - (neutron_lbaasv2 | bool) | ternary(neutron_optional_lbaas_pip_packages, []) + - (neutron_vpnaas | bool) | ternary(neutron_optional_vpnaas_pip_packages, []) + - (neutron_sfc | bool) | ternary(neutron_optional_sfc_pip_packages, []) + - (neutron_oslomsg_amqp1_enabled | bool) | ternary(neutron_optional_oslomsg_amqp1_pip_packages, []) }} - venv_facts_when_changed: - - section: "neutron" - option: "need_db_expand" - value: "True" - - section: "neutron" - option: "need_db_contract" - value: "True" - - section: "neutron" - option: "venv_tag" - value: "{{ neutron_venv_tag }}" diff --git a/tasks/providers/calico_config.yml b/tasks/providers/calico_config.yml index 95cea862..4c4c527e 100644 --- a/tasks/providers/calico_config.yml +++ b/tasks/providers/calico_config.yml @@ -13,29 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Install Calico pip packages - pip: - name: "{{ neutron_optional_calico_pip_packages }}" - state: "{{ neutron_pip_package_state }}" - virtualenv: "{{ neutron_bin | dirname }}" - virtualenv_site_packages: "no" - extra_args: >- - {{ neutron_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 - when: - - neutron_services['neutron-server']['group'] in group_names - or neutron_services['calico-felix']['group'] in group_names - or neutron_services['calico-dhcp-agent']['group'] in group_names - notify: Restart neutron services - tags: - - calico-install - - calico-pip-packages - - name: Install Calico Felix agent get_url: url: "{{ calico_felix_url }}" diff --git a/tasks/providers/nuage_config.yml b/tasks/providers/nuage_config.yml deleted file mode 100644 index 781470dd..00000000 --- a/tasks/providers/nuage_config.yml +++ /dev/null @@ -1,25 +0,0 @@ ---- -# Copyright 2016 Nuage Networks -# -# 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 nuage neutron pip packages - pip: - name: "{{ neutron_proprietary_nuage_pip_packages }}" - state: "{{ neutron_pip_package_state }}" - virtualenv: "{{ neutron_bin | dirname }}" - virtualenv_site_packages: "no" - retries: 5 - delay: 2 - when: - - neutron_services['neutron-server']['group'] in group_names diff --git a/tasks/providers/opendaylight_config.yml b/tasks/providers/opendaylight_config.yml index b61d9878..1d7e46d6 100644 --- a/tasks/providers/opendaylight_config.yml +++ b/tasks/providers/opendaylight_config.yml @@ -13,32 +13,5 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Set the packages to install - set_fact: - neutron_optional_combined_pip_packages: |- - {% set packages = neutron_optional_opendaylight_pip_packages %} - {% if 'sfc' in neutron_plugin_base %} - {% set _ = packages.extend(neutron_optional_sfc_pip_packages) %} - {% endif %} - {{ packages }} - -- name: Install OpenDaylight pip packages - pip: - name: "{{ neutron_optional_combined_pip_packages }}" - state: "{{ neutron_pip_package_state }}" - virtualenv: "{{ neutron_bin | dirname }}" - virtualenv_site_packages: "no" - extra_args: >- - {{ neutron_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: - - opendaylight-install - - opendaylight-pip-packages - - import_tasks: setup_ovs_opendaylight.yml when: neutron_services['neutron-server']['group'] not in group_names diff --git a/tasks/providers/ovn_config.yml b/tasks/providers/ovn_config.yml index f32ed3a6..f96b70c1 100644 --- a/tasks/providers/ovn_config.yml +++ b/tasks/providers/ovn_config.yml @@ -14,29 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Install OVN pip packages - pip: - name: "{{ neutron_optional_ovn_pip_packages }}" - state: "{{ neutron_pip_package_state }}" - virtualenv: "{{ neutron_bin | dirname }}" - virtualenv_site_packages: "no" - extra_args: >- - {{ neutron_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|success - retries: 5 - delay: 2 - when: - - neutron_services['neutron-server']['group'] in group_names - or neutron_services['neutron-ovn-northd']['group'] in group_names - or neutron_services['neutron-ovn-controller']['group'] in group_names - notify: Restart neutron services - tags: - - ovn-install - - ovn-pip-packages - - name: Install ovn-northd packages package: name: "{{ neutron_ovn_northd_distro_packages }}" diff --git a/vars/main.yml b/vars/main.yml index 952997e1..86f66af7 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -73,6 +73,51 @@ neutron_proprietary_nuage_pip_packages: neutron_optional_ovn_pip_packages: - networking-ovn +neutron_venv_packages: >- + {%- set pkg_list = neutron_pip_packages | union(neutron_user_pip_packages) %} + {%- if neutron_bgp | bool %} + {%- set _ = pkg_list.extend(neutron_optional_bgp_pip_packages) %} + {%- endif %} + {%- if (neutron_fwaas | bool) or (neutron_fwaas_v2 | bool) %} + {%- set _ = pkg_list.extend(neutron_optional_fwaas_pip_packages) %} + {%- endif %} + {%- if neutron_lbaasv2 | bool %} + {%- set _ = pkg_list.extend(neutron_optional_lbaas_pip_packages) %} + {%- endif %} + {%- if neutron_vpnaas | bool %} + {%- set _ = pkg_list.extend(neutron_optional_vpnaas_pip_packages) %} + {%- endif %} + {%- if neutron_sfc | bool %} + {%- set _ = pkg_list.extend(neutron_optional_sfc_pip_packages) %} + {%- endif %} + {%- if neutron_oslomsg_amqp1_enabled | bool %} + {%- set _ = pkg_list.extend(neutron_optional_oslomsg_amqp1_pip_packages) %} + {%- endif %} + {%- if (neutron_plugin_type.split('.')[-1] == 'calico') and + ((neutron_services['neutron-server']['group'] in group_names) or + (neutron_services['calico-felix']['group'] in group_names) or + (neutron_services['calico-dhcp-agent']['group'] in group_names)) %} + {%- set _ = pkg_list.extend(neutron_optional_calico_pip_packages) %} + {%- endif %} + {%- if (neutron_plugin_type.split('.')[-1] == 'nuage') and + (neutron_services['neutron-server']['group'] in group_names) %} + {%- set _ = pkg_list.extend(neutron_optional_nuage_pip_packages) %} + {%- endif %} + {%- if neutron_plugin_type.split('.')[-1] == 'opendaylight' %} + {%- set _ = pkg_list.extend(neutron_optional_opendaylight_pip_packages) %} + {%- if 'sfc' in neutron_plugin_base %} + {%- set _ = pkg_list.extend(neutron_optional_sfc_pip_packages) %} + {%- endif %} + {%- endif %} + {%- if (neutron_plugin_type.split('.')[-1] == 'ovn') and + ((neutron_services['neutron-server']['group'] in group_names) or + (neutron_services['neutron-ovn-northd']['group'] in group_names) or + (neutron_services['neutron-ovn-controller']['group'] in group_names)) %} + {%- set _ = pkg_list.extend(neutron_optional_ovn_pip_packages) %} + {%- endif %} + {{- pkg_list | unique }} + + ### ### Generic Neutron Config ### diff --git a/vars/source_install.yml b/vars/source_install.yml index b425a548..8ff920e2 100644 --- a/vars/source_install.yml +++ b/vars/source_install.yml @@ -63,5 +63,3 @@ neutron_package_list: |- {{ packages }} neutron_bin: "/openstack/venvs/neutron-{{ neutron_venv_tag }}/bin" - -neutron_venv_download: "{{ not neutron_developer_mode | bool }}"