Matt Thompson a0ab6f7a6e Symlink ceph libraries out of venv
Currently, we install python-rados and python-rbd via apt when ceph
integration is enabled, which causes issues when venvs are used in the
environment.  This commit adds a temporary work-around by creating
symlinks in the venv to the installed libraries outside.

There is currently a ceph issue [1] in progress to make this possible,
and once this has been completed we can update ceph_client role to
install python packages instead.

[1] http://tracker.ceph.com/issues/5900

Change-Id: Ia7a3ceae002054fd75e0305892b20ce1143f8dcc
Closes-Bug: #1509837
2015-11-04 15:51:28 +00:00

164 lines
4.2 KiB
YAML

---
# Copyright 2014, 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: Update apt sources
apt:
update_cache: yes
cache_valid_time: 600
register: apt_update
until: apt_update|success
retries: 5
delay: 2
tags:
- glance-apt-packages
- name: Install apt packages
apt:
pkg: "{{ item }}"
state: latest
register: install_packages
until: install_packages|success
retries: 5
delay: 2
with_items: glance_apt_packages
tags:
- glance-install
- glance-apt-packages
- name: Install requires pip packages
pip:
name: "{{ item }}"
state: present
extra_args: "{{ pip_install_options|default('') }}"
register: install_packages
until: install_packages|success
retries: 5
delay: 2
with_items:
- "{{ glance_requires_pip_packages }}"
tags:
- glance-install
- glance-pip-packages
- name: Attempt venv download
get_url:
url: "{{ glance_venv_download_url }}"
dest: "/var/cache/{{ glance_venv_download_url | basename }}"
ignore_errors: true
register: get_venv
when: glance_venv_enabled | bool
tags:
- glance-install
- glance-pip-packages
- name: Set glance get_venv fact
set_fact:
glance_get_venv: "{{ get_venv }}"
when: glance_venv_enabled | bool
tags:
- glance-install
- glance-pip-packages
- name: Create glance venv dir
file:
path: "{{ glance_venv_bin | dirname }}"
state: directory
when:
- glance_venv_enabled | bool
- glance_get_venv | success
tags:
- glance-install
- glance-pip-packages
- name: Unarchive pre-built venv
unarchive:
src: "/var/cache/{{ glance_venv_download_url | basename }}"
dest: "{{ glance_venv_bin | dirname }}"
copy: "no"
when:
- glance_venv_enabled | bool
- glance_get_venv | success
tags:
- glance-install
- glance-pip-packages
- name: Update virtualenv path
command: >
virtualenv-tools --update-path=auto {{ glance_venv_bin | dirname }}
when:
- glance_venv_enabled | bool
- glance_get_venv | success
tags:
- glance-install
- glance-pip-packages
- name: Install pip packages (venv)
pip:
name: "{{ item }}"
state: present
virtualenv: "{{ glance_venv_bin | dirname }}"
virtualenv_site_packages: "no"
extra_args: "{{ pip_install_options|default('') }}"
register: install_packages
until: install_packages|success
retries: 5
delay: 2
with_items:
- "{{ glance_pip_packages }}"
when:
- glance_venv_enabled | bool
- glance_get_venv | failed
tags:
- glance-install
- glance-pip-packages
# TODO(mattt): remove once ceph_client role can install ceph packages from pypi
# This is being done as a temporary workaround since we currently cannot obtain
# ceph-related libraries from pypi. There is work in progress [1] to address
# this.
# [1] http://tracker.ceph.com/issues/5900
- name: Link ceph libraries into the venv
file:
src: "{{ item.name }}"
dest: "{{ glance_venv_bin | dirname }}/lib/python2.7/site-packages/{{ item.name | basename }}"
state: "{{ item.state }}"
force: "yes"
with_items:
- { state: link, name: "/usr/lib/python2.7/dist-packages/rados.py" }
- { state: link, name: "/usr/lib/python2.7/dist-packages/rbd.py" }
when:
- glance_venv_enabled | bool
- inventory_hostname in groups['glance_api']
- glance_default_store == 'rbd'
tags:
- glance-install
- glance-pip-packages
- name: Install pip packages (no venv)
pip:
name: "{{ item }}"
state: present
extra_args: "{{ pip_install_options|default('') }}"
register: install_packages
until: install_packages|success
retries: 5
delay: 2
with_items:
- "{{ glance_pip_packages }}"
when: not glance_venv_enabled | bool
tags:
- glance-install
- glance-pip-packages