diff --git a/defaults/main.yml b/defaults/main.yml index 67024d3d..98e22bab 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -40,25 +40,12 @@ neutron_developer_constraints: # Name of the virtual env to deploy into neutron_venv_tag: untagged -neutron_venv_bin: "/openstack/venvs/neutron-{{ neutron_venv_tag }}/bin" - -# Set this to enable or disable installing in a venv -neutron_venv_enabled: true - -# The bin path defaults to the venv path however if installation in a -# venv is disabled the bin path will be dynamically set based on the -# system path used when the installing. -neutron_bin: "{{ neutron_venv_bin }}" +neutron_bin: "/openstack/venvs/neutron-{{ neutron_venv_tag }}/bin" neutron_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/neutron.tgz # Set the lib dir path to that of the local python path where neutron is installed. -# This is used for role access to the db migrations. -# Example: -# neutron_lib_dir: "/usr/local/lib/python2.7/dist-packages/" -neutron_venv_lib_dir: "{{ neutron_bin | dirname }}/lib/python2.7/site-packages/" -neutron_non_venv_lib_dir: "/usr/local/lib/python2.7/dist-packages/" -neutron_lib_dir: "{{ (neutron_venv_enabled | bool) | ternary(neutron_venv_lib_dir, neutron_non_venv_lib_dir) }}" +neutron_lib_dir: "{{ neutron_bin | dirname }}/lib/python2.7/site-packages/" # Enable/Disable Ceilometer neutron_ceilometer_enabled: False diff --git a/releasenotes/notes/os_neutron-only-install-venv-ca3bf63ed0507e4b.yaml b/releasenotes/notes/os_neutron-only-install-venv-ca3bf63ed0507e4b.yaml new file mode 100644 index 00000000..08188ccc --- /dev/null +++ b/releasenotes/notes/os_neutron-only-install-venv-ca3bf63ed0507e4b.yaml @@ -0,0 +1,6 @@ +--- +upgrade: + - Installation of neutron and its dependent pip packages will now only + occur within a Python virtual environment. The ``neutron_venv_enabled``, + ``neutron_venv_bin``, ``neutron_non_venv_lib_dir`` and + ``neutron_venv_lib_dir`` variables have been removed. diff --git a/tasks/neutron_install.yml b/tasks/neutron_install.yml index ac7aa803..65c039da 100644 --- a/tasks/neutron_install.yml +++ b/tasks/neutron_install.yml @@ -83,7 +83,6 @@ get_md5: False when: - not neutron_developer_mode | bool - - neutron_venv_enabled | bool register: local_venv_stat tags: - neutron-install @@ -95,7 +94,6 @@ return_content: True when: - not neutron_developer_mode | bool - - neutron_venv_enabled | bool register: remote_venv_checksum tags: - neutron-install @@ -115,7 +113,6 @@ register: get_venv when: - not neutron_developer_mode | bool - - neutron_venv_enabled | bool - (local_venv_stat.stat.exists == False or {{ local_venv_stat.stat.checksum is defined and local_venv_stat.stat.checksum != remote_venv_checksum.content | trim }}) tags: @@ -125,17 +122,15 @@ - name: Set neutron get_venv fact set_fact: neutron_get_venv: "{{ get_venv }}" - when: neutron_venv_enabled | bool tags: - neutron-install - neutron-pip-packages - name: Remove existing venv file: - path: "{{ neutron_venv_bin | dirname }}" + path: "{{ neutron_bin | dirname }}" state: absent when: - - neutron_venv_enabled | bool - neutron_get_venv | changed tags: - neutron-install @@ -143,12 +138,11 @@ - name: Create neutron venv dir file: - path: "{{ neutron_venv_bin | dirname }}" + path: "{{ neutron_bin | dirname }}" state: directory + register: neutron_venv_dir when: - not neutron_developer_mode | bool - - neutron_venv_enabled | bool - - neutron_get_venv | changed tags: - neutron-install - neutron-pip-packages @@ -156,33 +150,21 @@ - name: Unarchive pre-built venv unarchive: src: "/var/cache/{{ neutron_venv_download_url | basename }}" - dest: "{{ neutron_venv_bin | dirname }}" + dest: "{{ neutron_bin | dirname }}" copy: "no" when: - not neutron_developer_mode | bool - - neutron_venv_enabled | bool - - neutron_get_venv | changed + - neutron_get_venv | changed or neutron_venv_dir | changed notify: Restart neutron services tags: - neutron-install - neutron-pip-packages -- name: Update virtualenv path - command: > - virtualenv-tools --update-path=auto {{ neutron_venv_bin | dirname }} - when: - - not neutron_developer_mode | bool - - neutron_venv_enabled | bool - - neutron_get_venv | success - tags: - - neutron-install - - neutron-pip-packages - -- name: Install pip packages (venv) +- name: Install pip packages pip: name: "{{ item }}" state: latest - virtualenv: "{{ neutron_venv_bin | dirname }}" + virtualenv: "{{ neutron_bin | dirname }}" virtualenv_site_packages: "no" extra_args: "{{ pip_install_options_fact }}" register: install_packages @@ -191,27 +173,17 @@ delay: 2 with_items: "{{ neutron_pip_packages }}" when: - - neutron_venv_enabled | bool - neutron_get_venv | failed or neutron_developer_mode | bool notify: Restart neutron services tags: - neutron-install - neutron-pip-packages -- name: Install pip packages (no venv) - pip: - name: "{{ item }}" - state: latest - extra_args: "{{ pip_install_options_fact }}" - register: install_packages - until: install_packages|success - retries: 5 - delay: 2 - with_items: "{{ neutron_pip_packages }}" +- name: Update virtualenv path + command: > + virtualenv-tools --update-path=auto {{ neutron_bin | dirname }} when: - not neutron_developer_mode | bool - - not neutron_venv_enabled | bool - notify: Restart neutron services tags: - neutron-install - - neutron-pip-packages + - neutron-pip-packages \ No newline at end of file diff --git a/tasks/neutron_post_install.yml b/tasks/neutron_post_install.yml index cfe9734a..f42f5ab0 100644 --- a/tasks/neutron_post_install.yml +++ b/tasks/neutron_post_install.yml @@ -130,22 +130,6 @@ when: - neutron_plugin_type == 'nuage' -- name: Get neutron command path - command: which neutron - register: neutron_command_path - when: - - not neutron_venv_enabled | bool - tags: - - neutron-command-bin - -- name: Set neutron command path - set_fact: - neutron_bin: "{{ neutron_command_path.stdout | dirname }}" - when: - - not neutron_venv_enabled | bool - tags: - - neutron-command-bin - - name: Drop sudoers file template: src: "sudoers.j2" diff --git a/tasks/neutron_pre_install.yml b/tasks/neutron_pre_install.yml index 81043234..66a0b6ad 100644 --- a/tasks/neutron_pre_install.yml +++ b/tasks/neutron_pre_install.yml @@ -54,17 +54,6 @@ tags: - neutron-dirs -- name: Create neutron venv dir - file: - path: "{{ item.path }}" - state: directory - with_items: - - { path: "/openstack/venvs" } - - { path: "{{ neutron_venv_bin }}" } - when: neutron_venv_enabled | bool - tags: - - neutron-dirs - - name: Test for log directory or link shell: | if [ -h "/var/log/neutron" ]; then diff --git a/tasks/nuage_neutron_config.yml b/tasks/nuage_neutron_config.yml index ad6264aa..f3ef3511 100644 --- a/tasks/nuage_neutron_config.yml +++ b/tasks/nuage_neutron_config.yml @@ -12,33 +12,17 @@ # License for the specific language governing permissions and limitations # under the License. -- name: Install nuage neutron pip packages (venv) +- name: Install nuage neutron pip packages pip: name: "{{ item }}" state: latest - virtualenv: "{{ neutron_venv_bin | dirname }}" + virtualenv: "{{ neutron_bin | dirname }}" virtualenv_site_packages: "no" retries: 5 delay: 2 with_items: - "{{ neutron_proprietary_nuage_pip_packages }}" when: - - neutron_venv_enabled | bool - - inventory_hostname in groups[neutron_services['neutron-server']['group']] - tags: - - neutron-install - - neutron-pip-packages - -- name: Install nuage neutron pip packages (no venv) - pip: - name: "{{ item }}" - state: latest - retries: 5 - delay: 2 - with_items: - - "{{ neutron_proprietary_nuage_pip_packages }}" - when: - - not neutron_venv_enabled | bool - inventory_hostname in groups[neutron_services['neutron-server']['group']] tags: - neutron-install diff --git a/tasks/plumgrid_config.yml b/tasks/plumgrid_config.yml index 79c70937..c43aa2f3 100644 --- a/tasks/plumgrid_config.yml +++ b/tasks/plumgrid_config.yml @@ -32,11 +32,11 @@ tags: - neutron_config -- name: Install plumgrid pip packages (venv) +- name: Install plumgrid pip packages pip: name: "{{ item }}" state: latest - virtualenv: "{{ neutron_venv_bin | dirname }}" + virtualenv: "{{ neutron_bin | dirname }}" virtualenv_site_packages: "no" extra_args: "{{ pip_install_options|default('') }}" register: install_packages @@ -47,17 +47,16 @@ with_items: - "{{ neutron_optional_plumgrid_pip_packages }}" when: - - neutron_venv_enabled | bool - inventory_hostname in groups[neutron_services['neutron-server']['group']] tags: - neutron-install - neutron-pip-packages -- name: Install plumgrid pip packages fall back (venv) +- name: Install plumgrid pip packages fall back pip: name: "{{ item }}" state: latest - virtualenv: "{{ neutron_venv_bin | dirname }}" + virtualenv: "{{ neutron_bin | dirname }}" virtualenv_site_packages: "no" extra_args: "--isolated" register: install_packages_fall_back @@ -68,45 +67,6 @@ - "{{ neutron_optional_plumgrid_pip_packages }}" when: - install_packages | failed - - neutron_venv_enabled | bool - - inventory_hostname in groups[neutron_services['neutron-server']['group']] - tags: - - neutron-install - - neutron-pip-packages - -- name: Install plumgrid pip packages (no venv) - pip: - name: "{{ item }}" - state: latest - extra_args: "{{ pip_install_options|default('') }}" - register: install_packages - until: install_packages|success - retries: 5 - delay: 2 - ignore_errors: True - with_items: - - "{{ neutron_optional_plumgrid_pip_packages }}" - when: - - not neutron_venv_enabled | bool - - inventory_hostname in groups[neutron_services['neutron-server']['group']] - tags: - - neutron-install - - neutron-pip-packages - -- name: Install plumgrid pip packages fall back (no venv) - pip: - name: "{{ item }}" - state: latest - extra_args: "--isolated" - register: install_packages_fall_back - until: install_packages_fall_back|success - retries: 5 - delay: 2 - with_items: - - "{{ neutron_optional_plumgrid_pip_packages }}" - when: - - install_packages | failed - - not neutron_venv_enabled | bool - inventory_hostname in groups[neutron_services['neutron-server']['group']] tags: - neutron-install diff --git a/templates/neutron-ha-tool.py.j2 b/templates/neutron-ha-tool.py.j2 index f5646778..eed9a0c1 100644 --- a/templates/neutron-ha-tool.py.j2 +++ b/templates/neutron-ha-tool.py.j2 @@ -1,4 +1,4 @@ -#!{{ neutron_venv_enabled | bool | ternary(neutron_venv_bin + "/", "/usr/bin/env ") }}python +#!{{ neutron_bin }}/python # Copyright 2013 AT&T Services, Inc. # All Rights Reserved. diff --git a/templates/neutron-upstart-init.j2 b/templates/neutron-upstart-init.j2 index bfeb7973..f6b60cc7 100644 --- a/templates/neutron-upstart-init.j2 +++ b/templates/neutron-upstart-init.j2 @@ -23,9 +23,8 @@ pre-start script mkdir -p "/var/lock/{{ program_name }}" chown {{ system_user }}:{{ system_group }} "/var/lock/{{ program_name }}" - {% if neutron_venv_enabled | bool -%} - . {{ neutron_venv_bin }}/activate - {%- endif %} + . {{ neutron_bin }}/activate + end script