Only install to virtual environment
Remove all tasks and variables related to toggling between installation of neutron inside or outside of a Python virtual environment. Installing within a venv is now the only supported deployment. Additionally, a few changes have been made to make the creation of the venv more resistant to interruptions during a run of the role. * unarchiving a pre-built venv will now also occur when the venv directory is created, not only after being downloaded * virtualenv-tools is run against both pre-built and non pre-built venvs to account for interruptions during or prior to unarchiving Change-Id: Ie0111886391d7ecdd50f1ac3a94f46a49f91f3fe Implements: blueprint only-install-venvs
This commit is contained in:
parent
7d65733e5a
commit
e5a67a7c68
@ -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
|
||||
|
@ -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.
|
@ -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
|
@ -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"
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user