openstack-ansible-repo_build/tasks/repo_venv_build.yml

75 lines
2.0 KiB
YAML

---
# 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 venv command path
command: which virtualenv
register: virtualenv_path
tags:
- always
- name: Set virtualenv command path
set_fact:
virtualenv_bin: "{{ virtualenv_path.stdout }}"
tags:
- always
- name: Check for created venvs
command: >
ls -1 "{{ repo_build_venv_dir }}/{{ repo_build_release_tag }}/{{ ansible_distribution | lower }}/"
register: created_venvs
tags:
- repo-create-venv
- name: Set existing venv fact
set_fact:
existing_venvs: "{{ created_venvs.stdout_lines }}"
tags:
- repo-command-bin
- repo-create-venv
# This is removed so that virtual env is not installing unknown
# packages as assumed wheels, IE pip8
- name: Ensure virtualenv_support is absent
file:
path: "{{ item }}"
state: "absent"
with_items:
- "/usr/local/lib/python2.7/dist-packages/virtualenv_support"
- "/usr/local/lib/python2.7/site-packages/virtualenv_support"
tags:
- repo-create-venv
- name: Create venv process script
template:
src: "op-venv-script.sh.j2"
dest: "/opt/op-venv-script.sh"
tags:
- repo-create-venv
- name: Run venv process script
shell: "bash /opt/op-venv-script.sh"
tags:
- repo-create-venv
- repo-venv-compress-archive
- repo-create-venv-archive
- repo-create-venv-checksum
- name: Remove venv process script
file:
path: "/opt/op-venv-script.sh"
state: absent
tags:
- repo-create-venv