Only install to virtual environment
Remove all tasks and variables related to toggling between installation of swift 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: Id2a27c082a5eb4eddc9eacde9de30f4e61f9ec36 Implements: blueprint only-install-venvs
This commit is contained in:
parent
e4b4d621b2
commit
9d30bb30b9
@ -29,15 +29,7 @@ swift_developer_constraints:
|
||||
|
||||
# Name of the virtual env to deploy into
|
||||
swift_venv_tag: untagged
|
||||
swift_venv_bin: "/openstack/venvs/swift-{{ swift_venv_tag }}/bin"
|
||||
|
||||
# Set this to enable or disable installing in a venv
|
||||
swift_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.
|
||||
swift_bin: "{{ swift_venv_bin }}"
|
||||
swift_bin: "/openstack/venvs/swift-{{ swift_venv_tag }}/bin"
|
||||
|
||||
swift_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/swift.tgz
|
||||
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
upgrade:
|
||||
- Installation of swift and its dependent pip packages will now only
|
||||
occur within a Python virtual environment. The ``swift_venv_enabled``,
|
||||
``swift_venv_bin`` variables have been removed.
|
@ -85,12 +85,6 @@
|
||||
tags:
|
||||
- swift-setup
|
||||
|
||||
- include: swift_command_check.yml
|
||||
when:
|
||||
- swift_do_sync | bool
|
||||
tags:
|
||||
- swift-sync
|
||||
|
||||
- include: swift_key_setup.yml
|
||||
when:
|
||||
- swift_do_sync | bool
|
||||
|
@ -1,30 +0,0 @@
|
||||
---
|
||||
# Copyright 2015, 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: Get swift command path
|
||||
command: which swift
|
||||
register: swift_command_path
|
||||
when:
|
||||
- not swift_venv_enabled | bool
|
||||
tags:
|
||||
- swift-command-bin
|
||||
|
||||
- name: Set swift command path
|
||||
set_fact:
|
||||
swift_bin: "{{ swift_command_path.stdout | dirname }}"
|
||||
when:
|
||||
- not swift_venv_enabled | bool
|
||||
tags:
|
||||
- swift-command-bin
|
@ -84,7 +84,6 @@
|
||||
when:
|
||||
- not swift_pypy_enabled | bool
|
||||
- not swift_developer_mode | bool
|
||||
- swift_venv_enabled | bool
|
||||
register: local_venv_stat
|
||||
tags:
|
||||
- swift-install
|
||||
@ -97,7 +96,6 @@
|
||||
when:
|
||||
- not swift_pypy_enabled | bool
|
||||
- not swift_developer_mode | bool
|
||||
- swift_venv_enabled | bool
|
||||
register: remote_venv_checksum
|
||||
tags:
|
||||
- swift-install
|
||||
@ -118,7 +116,6 @@
|
||||
when:
|
||||
- not swift_pypy_enabled | bool
|
||||
- not swift_developer_mode | bool
|
||||
- swift_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:
|
||||
@ -128,18 +125,16 @@
|
||||
- name: Set swift get_venv fact
|
||||
set_fact:
|
||||
swift_get_venv: "{{ get_venv }}"
|
||||
when: swift_venv_enabled | bool
|
||||
tags:
|
||||
- swift-install
|
||||
- swift-pip-packages
|
||||
|
||||
- name: Remove existing venv
|
||||
file:
|
||||
path: "{{ swift_venv_bin | dirname }}"
|
||||
path: "{{ swift_bin | dirname }}"
|
||||
state: absent
|
||||
when:
|
||||
- not swift_pypy_enabled | bool
|
||||
- swift_venv_enabled | bool
|
||||
- swift_get_venv | changed
|
||||
tags:
|
||||
- swift-install
|
||||
@ -147,13 +142,9 @@
|
||||
|
||||
- name: Create swift venv dir
|
||||
file:
|
||||
path: "{{ swift_venv_bin | dirname }}"
|
||||
path: "{{ swift_bin | dirname }}"
|
||||
state: directory
|
||||
when:
|
||||
- not swift_pypy_enabled | bool
|
||||
- not swift_developer_mode | bool
|
||||
- swift_venv_enabled | bool
|
||||
- swift_get_venv | changed
|
||||
register: swift_venv_dir
|
||||
tags:
|
||||
- swift-install
|
||||
- swift-pip-packages
|
||||
@ -161,13 +152,36 @@
|
||||
- name: Unarchive pre-built venv
|
||||
unarchive:
|
||||
src: "/var/cache/{{ swift_venv_download_url | basename }}"
|
||||
dest: "{{ swift_venv_bin | dirname }}"
|
||||
dest: "{{ swift_bin | dirname }}"
|
||||
copy: "no"
|
||||
when:
|
||||
- not swift_pypy_enabled | bool
|
||||
- not swift_developer_mode | bool
|
||||
- swift_venv_enabled | bool
|
||||
- swift_get_venv | changed
|
||||
- swift_get_venv | changed or swift_venv_dir | changed
|
||||
notify:
|
||||
- Restart swift account services
|
||||
- Restart swift container services
|
||||
- Restart swift object services
|
||||
- Restart swift proxy services
|
||||
tags:
|
||||
- swift-install
|
||||
- swift-pip-packages
|
||||
|
||||
- name: Install pip packages
|
||||
pip:
|
||||
name: "{{ item }}"
|
||||
state: latest
|
||||
virtualenv: "{{ swift_bin | dirname }}"
|
||||
virtualenv_site_packages: "no"
|
||||
extra_args: "{{ pip_install_options_fact }}"
|
||||
register: install_packages
|
||||
until: install_packages|success
|
||||
retries: 5
|
||||
delay: 2
|
||||
with_items: swift_pip_packages
|
||||
when:
|
||||
- not swift_pypy_enabled | bool
|
||||
- swift_get_venv | failed or swift_developer_mode | bool
|
||||
notify:
|
||||
- Restart swift account services
|
||||
- Restart swift container services
|
||||
@ -179,64 +193,15 @@
|
||||
|
||||
- name: Update virtualenv path
|
||||
command: >
|
||||
virtualenv-tools --update-path=auto {{ swift_venv_bin | dirname }}
|
||||
virtualenv-tools --update-path=auto {{ swift_bin | dirname }}
|
||||
when:
|
||||
- not swift_pypy_enabled | bool
|
||||
- not swift_developer_mode | bool
|
||||
- swift_venv_enabled | bool
|
||||
- swift_get_venv | success
|
||||
tags:
|
||||
- swift-install
|
||||
- swift-pip-packages
|
||||
|
||||
- name: Install pip packages (venv)
|
||||
pip:
|
||||
name: "{{ item }}"
|
||||
state: latest
|
||||
virtualenv: "{{ swift_venv_bin | dirname }}"
|
||||
virtualenv_site_packages: "no"
|
||||
extra_args: "{{ pip_install_options_fact }}"
|
||||
register: install_packages
|
||||
until: install_packages|success
|
||||
retries: 5
|
||||
delay: 2
|
||||
with_items: swift_pip_packages
|
||||
when:
|
||||
- not swift_pypy_enabled | bool
|
||||
- swift_venv_enabled | bool
|
||||
- swift_get_venv | failed or swift_developer_mode | bool
|
||||
notify:
|
||||
- Restart swift account services
|
||||
- Restart swift container services
|
||||
- Restart swift object services
|
||||
- Restart swift proxy services
|
||||
tags:
|
||||
- swift-install
|
||||
- swift-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: swift_pip_packages
|
||||
when:
|
||||
- not swift_pypy_enabled | bool
|
||||
- not swift_developer_mode | bool
|
||||
- not swift_venv_enabled | bool
|
||||
notify:
|
||||
- Restart swift account services
|
||||
- Restart swift container services
|
||||
- Restart swift object services
|
||||
- Restart swift proxy services
|
||||
tags:
|
||||
- swift-install
|
||||
- swift-pip-packages
|
||||
|
||||
- include: swift_pypy_setup.yml
|
||||
when: swift_pypy_enabled | bool
|
||||
tags:
|
||||
|
@ -62,18 +62,3 @@
|
||||
- swift-config
|
||||
- swift-post-install
|
||||
|
||||
- name: Get swift command path
|
||||
command: which swift
|
||||
register: swift_command_path
|
||||
when:
|
||||
- not swift_venv_enabled | bool
|
||||
tags:
|
||||
- swift-command-bin
|
||||
|
||||
- name: Set swift command path
|
||||
set_fact:
|
||||
swift_bin: "{{ swift_command_path.stdout | dirname }}"
|
||||
when:
|
||||
- not swift_venv_enabled | bool
|
||||
tags:
|
||||
- swift-command-bin
|
||||
|
@ -73,17 +73,6 @@
|
||||
tags:
|
||||
- swift-dirs
|
||||
|
||||
- name: Create swift venv dir
|
||||
file:
|
||||
path: "{{ item.path }}"
|
||||
state: directory
|
||||
with_items:
|
||||
- { path: "/openstack/venvs" }
|
||||
- { path: "{{ swift_venv_bin }}" }
|
||||
when: swift_venv_enabled | bool
|
||||
tags:
|
||||
- swift-dirs
|
||||
|
||||
- name: Test for log directory or link
|
||||
shell: |
|
||||
if [ -h "/var/log/swift" ]; then
|
||||
|
@ -51,13 +51,13 @@
|
||||
|
||||
- name: Check for pypy venv
|
||||
stat:
|
||||
path: "{{ swift_venv_bin | dirname }}/{{ swift_pypy_version }}-inuse"
|
||||
path: "{{ swift_bin | dirname }}/{{ swift_pypy_version }}-inuse"
|
||||
get_md5: False
|
||||
register: local_pypy_venv_stat
|
||||
|
||||
- name: Remove existing venv if not pypy setup
|
||||
file:
|
||||
path: "{{ swift_venv_bin | dirname }}"
|
||||
path: "{{ swift_bin | dirname }}"
|
||||
state: absent
|
||||
when: not local_pypy_venv_stat.stat.exists | bool
|
||||
|
||||
@ -65,7 +65,7 @@
|
||||
pip:
|
||||
name: "{{ item }}"
|
||||
state: latest
|
||||
virtualenv: "{{ swift_venv_bin | dirname }}"
|
||||
virtualenv: "{{ swift_bin | dirname }}"
|
||||
virtualenv_site_packages: "no"
|
||||
virtualenv_command: "{{ swift_pypy_env | dirname }}/virtualenv"
|
||||
extra_args: "{{ pip_install_options_fact }}"
|
||||
@ -82,5 +82,5 @@
|
||||
|
||||
- name: Mark swift venv for use with pypy
|
||||
file:
|
||||
path: "{{ swift_venv_bin | dirname }}/{{ swift_pypy_version }}-inuse"
|
||||
path: "{{ swift_bin | dirname }}/{{ swift_pypy_version }}-inuse"
|
||||
state: "touch"
|
||||
|
@ -147,7 +147,7 @@
|
||||
- name: Create drive-audit cron job
|
||||
cron:
|
||||
name: "Run drive-audit script"
|
||||
job: "{{ swift_venv_bin }}/swift-drive-audit /etc/swift/drive-audit.conf"
|
||||
job: "{{ swift_bin }}/swift-drive-audit /etc/swift/drive-audit.conf"
|
||||
minute: 15
|
||||
cron_file: swift-drive-audit
|
||||
user: root
|
||||
|
@ -26,9 +26,7 @@ pre-start script
|
||||
mkdir -p "/var/lock/{{ program_binary | default(program_name) }}"
|
||||
chown {{ system_user }}:{{ system_group }} "/var/lock/{{ program_binary | default(program_name) }}"
|
||||
|
||||
{% if swift_venv_enabled | bool -%}
|
||||
. {{ swift_venv_bin }}/activate
|
||||
{%- endif %}
|
||||
. {{ swift_bin }}/activate
|
||||
|
||||
end script
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!{{ swift_venv_enabled | bool | ternary(swift_venv_bin + "/", "/usr/bin/env ") }}python
|
||||
#!{{ swift_bin }}/python
|
||||
# Copyright 2014, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!{{ swift_venv_enabled | bool | ternary(swift_venv_bin + "/", "/usr/bin/env ") }}python
|
||||
#!{{ swift_bin }}/python
|
||||
# Copyright 2014, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
@ -101,7 +101,7 @@
|
||||
- name: Install requirements for swift
|
||||
pip:
|
||||
requirements: "{{ item }}"
|
||||
virtualenv: "{{ swift_venv_bin | dirname }}"
|
||||
virtualenv: "{{ swift_bin | dirname }}"
|
||||
with_items:
|
||||
- "/opt/swift/test-requirements.txt"
|
||||
- "/opt/swift/requirements.txt"
|
||||
|
@ -73,7 +73,7 @@ swift_service_password: "secrete"
|
||||
swift_developer_mode: true
|
||||
swift_git_install_branch: master
|
||||
swift_venv_tag: untagged
|
||||
swift_venv_bin: "/openstack/venvs/swift-{{ swift_venv_tag }}/bin"
|
||||
swift_bin: "/openstack/venvs/swift-{{ swift_venv_tag }}/bin"
|
||||
swift_service_publicuri: "http://10.100.100.102:8080"
|
||||
swift_service_adminuri: "http://10.100.100.102:8080"
|
||||
swift_service_internaluri: "http://10.100.100.102:8080"
|
||||
|
Loading…
Reference in New Issue
Block a user