Merge "Only install to virtual environment"
This commit is contained in:
commit
3869f7b044
@ -29,15 +29,7 @@ swift_developer_constraints:
|
|||||||
|
|
||||||
# Name of the virtual env to deploy into
|
# Name of the virtual env to deploy into
|
||||||
swift_venv_tag: untagged
|
swift_venv_tag: untagged
|
||||||
swift_venv_bin: "/openstack/venvs/swift-{{ swift_venv_tag }}/bin"
|
swift_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_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/swift.tgz
|
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:
|
tags:
|
||||||
- swift-setup
|
- swift-setup
|
||||||
|
|
||||||
- include: swift_command_check.yml
|
|
||||||
when:
|
|
||||||
- swift_do_sync | bool
|
|
||||||
tags:
|
|
||||||
- swift-sync
|
|
||||||
|
|
||||||
- include: swift_key_setup.yml
|
- include: swift_key_setup.yml
|
||||||
when:
|
when:
|
||||||
- swift_do_sync | bool
|
- 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:
|
when:
|
||||||
- not swift_pypy_enabled | bool
|
- not swift_pypy_enabled | bool
|
||||||
- not swift_developer_mode | bool
|
- not swift_developer_mode | bool
|
||||||
- swift_venv_enabled | bool
|
|
||||||
register: local_venv_stat
|
register: local_venv_stat
|
||||||
tags:
|
tags:
|
||||||
- swift-install
|
- swift-install
|
||||||
@ -97,7 +96,6 @@
|
|||||||
when:
|
when:
|
||||||
- not swift_pypy_enabled | bool
|
- not swift_pypy_enabled | bool
|
||||||
- not swift_developer_mode | bool
|
- not swift_developer_mode | bool
|
||||||
- swift_venv_enabled | bool
|
|
||||||
register: remote_venv_checksum
|
register: remote_venv_checksum
|
||||||
tags:
|
tags:
|
||||||
- swift-install
|
- swift-install
|
||||||
@ -118,7 +116,6 @@
|
|||||||
when:
|
when:
|
||||||
- not swift_pypy_enabled | bool
|
- not swift_pypy_enabled | bool
|
||||||
- not swift_developer_mode | bool
|
- not swift_developer_mode | bool
|
||||||
- swift_venv_enabled | bool
|
|
||||||
- (local_venv_stat.stat.exists == False or
|
- (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 }})
|
{{ local_venv_stat.stat.checksum is defined and local_venv_stat.stat.checksum != remote_venv_checksum.content | trim }})
|
||||||
tags:
|
tags:
|
||||||
@ -128,18 +125,16 @@
|
|||||||
- name: Set swift get_venv fact
|
- name: Set swift get_venv fact
|
||||||
set_fact:
|
set_fact:
|
||||||
swift_get_venv: "{{ get_venv }}"
|
swift_get_venv: "{{ get_venv }}"
|
||||||
when: swift_venv_enabled | bool
|
|
||||||
tags:
|
tags:
|
||||||
- swift-install
|
- swift-install
|
||||||
- swift-pip-packages
|
- swift-pip-packages
|
||||||
|
|
||||||
- name: Remove existing venv
|
- name: Remove existing venv
|
||||||
file:
|
file:
|
||||||
path: "{{ swift_venv_bin | dirname }}"
|
path: "{{ swift_bin | dirname }}"
|
||||||
state: absent
|
state: absent
|
||||||
when:
|
when:
|
||||||
- not swift_pypy_enabled | bool
|
- not swift_pypy_enabled | bool
|
||||||
- swift_venv_enabled | bool
|
|
||||||
- swift_get_venv | changed
|
- swift_get_venv | changed
|
||||||
tags:
|
tags:
|
||||||
- swift-install
|
- swift-install
|
||||||
@ -147,13 +142,9 @@
|
|||||||
|
|
||||||
- name: Create swift venv dir
|
- name: Create swift venv dir
|
||||||
file:
|
file:
|
||||||
path: "{{ swift_venv_bin | dirname }}"
|
path: "{{ swift_bin | dirname }}"
|
||||||
state: directory
|
state: directory
|
||||||
when:
|
register: swift_venv_dir
|
||||||
- not swift_pypy_enabled | bool
|
|
||||||
- not swift_developer_mode | bool
|
|
||||||
- swift_venv_enabled | bool
|
|
||||||
- swift_get_venv | changed
|
|
||||||
tags:
|
tags:
|
||||||
- swift-install
|
- swift-install
|
||||||
- swift-pip-packages
|
- swift-pip-packages
|
||||||
@ -161,13 +152,36 @@
|
|||||||
- name: Unarchive pre-built venv
|
- name: Unarchive pre-built venv
|
||||||
unarchive:
|
unarchive:
|
||||||
src: "/var/cache/{{ swift_venv_download_url | basename }}"
|
src: "/var/cache/{{ swift_venv_download_url | basename }}"
|
||||||
dest: "{{ swift_venv_bin | dirname }}"
|
dest: "{{ swift_bin | dirname }}"
|
||||||
copy: "no"
|
copy: "no"
|
||||||
when:
|
when:
|
||||||
- not swift_pypy_enabled | bool
|
- not swift_pypy_enabled | bool
|
||||||
- not swift_developer_mode | bool
|
- not swift_developer_mode | bool
|
||||||
- swift_venv_enabled | bool
|
- swift_get_venv | changed or swift_venv_dir | changed
|
||||||
- swift_get_venv | 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:
|
notify:
|
||||||
- Restart swift account services
|
- Restart swift account services
|
||||||
- Restart swift container services
|
- Restart swift container services
|
||||||
@ -179,64 +193,15 @@
|
|||||||
|
|
||||||
- name: Update virtualenv path
|
- name: Update virtualenv path
|
||||||
command: >
|
command: >
|
||||||
virtualenv-tools --update-path=auto {{ swift_venv_bin | dirname }}
|
virtualenv-tools --update-path=auto {{ swift_bin | dirname }}
|
||||||
when:
|
when:
|
||||||
- not swift_pypy_enabled | bool
|
- not swift_pypy_enabled | bool
|
||||||
- not swift_developer_mode | bool
|
- not swift_developer_mode | bool
|
||||||
- swift_venv_enabled | bool
|
|
||||||
- swift_get_venv | success
|
- swift_get_venv | success
|
||||||
tags:
|
tags:
|
||||||
- swift-install
|
- swift-install
|
||||||
- swift-pip-packages
|
- 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
|
- include: swift_pypy_setup.yml
|
||||||
when: swift_pypy_enabled | bool
|
when: swift_pypy_enabled | bool
|
||||||
tags:
|
tags:
|
||||||
|
@ -62,18 +62,3 @@
|
|||||||
- swift-config
|
- swift-config
|
||||||
- swift-post-install
|
- 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:
|
tags:
|
||||||
- swift-dirs
|
- 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
|
- name: Test for log directory or link
|
||||||
shell: |
|
shell: |
|
||||||
if [ -h "/var/log/swift" ]; then
|
if [ -h "/var/log/swift" ]; then
|
||||||
|
@ -51,13 +51,13 @@
|
|||||||
|
|
||||||
- name: Check for pypy venv
|
- name: Check for pypy venv
|
||||||
stat:
|
stat:
|
||||||
path: "{{ swift_venv_bin | dirname }}/{{ swift_pypy_version }}-inuse"
|
path: "{{ swift_bin | dirname }}/{{ swift_pypy_version }}-inuse"
|
||||||
get_md5: False
|
get_md5: False
|
||||||
register: local_pypy_venv_stat
|
register: local_pypy_venv_stat
|
||||||
|
|
||||||
- name: Remove existing venv if not pypy setup
|
- name: Remove existing venv if not pypy setup
|
||||||
file:
|
file:
|
||||||
path: "{{ swift_venv_bin | dirname }}"
|
path: "{{ swift_bin | dirname }}"
|
||||||
state: absent
|
state: absent
|
||||||
when: not local_pypy_venv_stat.stat.exists | bool
|
when: not local_pypy_venv_stat.stat.exists | bool
|
||||||
|
|
||||||
@ -65,7 +65,7 @@
|
|||||||
pip:
|
pip:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
state: latest
|
state: latest
|
||||||
virtualenv: "{{ swift_venv_bin | dirname }}"
|
virtualenv: "{{ swift_bin | dirname }}"
|
||||||
virtualenv_site_packages: "no"
|
virtualenv_site_packages: "no"
|
||||||
virtualenv_command: "{{ swift_pypy_env | dirname }}/virtualenv"
|
virtualenv_command: "{{ swift_pypy_env | dirname }}/virtualenv"
|
||||||
extra_args: "{{ pip_install_options_fact }}"
|
extra_args: "{{ pip_install_options_fact }}"
|
||||||
@ -82,5 +82,5 @@
|
|||||||
|
|
||||||
- name: Mark swift venv for use with pypy
|
- name: Mark swift venv for use with pypy
|
||||||
file:
|
file:
|
||||||
path: "{{ swift_venv_bin | dirname }}/{{ swift_pypy_version }}-inuse"
|
path: "{{ swift_bin | dirname }}/{{ swift_pypy_version }}-inuse"
|
||||||
state: "touch"
|
state: "touch"
|
||||||
|
@ -147,7 +147,7 @@
|
|||||||
- name: Create drive-audit cron job
|
- name: Create drive-audit cron job
|
||||||
cron:
|
cron:
|
||||||
name: "Run drive-audit script"
|
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
|
minute: 15
|
||||||
cron_file: swift-drive-audit
|
cron_file: swift-drive-audit
|
||||||
user: root
|
user: root
|
||||||
|
@ -26,9 +26,7 @@ pre-start script
|
|||||||
mkdir -p "/var/lock/{{ program_binary | default(program_name) }}"
|
mkdir -p "/var/lock/{{ program_binary | default(program_name) }}"
|
||||||
chown {{ system_user }}:{{ system_group }} "/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_bin }}/activate
|
||||||
. {{ swift_venv_bin }}/activate
|
|
||||||
{%- endif %}
|
|
||||||
|
|
||||||
end script
|
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.
|
# Copyright 2014, Rackspace US, Inc.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# 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.
|
# Copyright 2014, Rackspace US, Inc.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@ -101,7 +101,7 @@
|
|||||||
- name: Install requirements for swift
|
- name: Install requirements for swift
|
||||||
pip:
|
pip:
|
||||||
requirements: "{{ item }}"
|
requirements: "{{ item }}"
|
||||||
virtualenv: "{{ swift_venv_bin | dirname }}"
|
virtualenv: "{{ swift_bin | dirname }}"
|
||||||
with_items:
|
with_items:
|
||||||
- "/opt/swift/test-requirements.txt"
|
- "/opt/swift/test-requirements.txt"
|
||||||
- "/opt/swift/requirements.txt"
|
- "/opt/swift/requirements.txt"
|
||||||
|
@ -73,7 +73,7 @@ swift_service_password: "secrete"
|
|||||||
swift_developer_mode: true
|
swift_developer_mode: true
|
||||||
swift_git_install_branch: master
|
swift_git_install_branch: master
|
||||||
swift_venv_tag: untagged
|
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_publicuri: "http://10.100.100.102:8080"
|
||||||
swift_service_adminuri: "http://10.100.100.102:8080"
|
swift_service_adminuri: "http://10.100.100.102:8080"
|
||||||
swift_service_internaluri: "http://10.100.100.102:8080"
|
swift_service_internaluri: "http://10.100.100.102:8080"
|
||||||
|
Loading…
Reference in New Issue
Block a user