--- # Copyright 2018, 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: Copy the venv checksum file to the target host copy: src: "{{ venv_reuse_download_path }}/{{ venv_destination_path | basename }}.checksum" dest: "{{ venv_destination_path | dirname }}" register: _venv_checksum_copy when: - _src_venv_present.stat.exists | bool - name: Remove existing venv on target host if it is changing file: path: "{{ venv_destination_path }}" state: absent when: - _venv_checksum_copy is mapping - _venv_checksum_copy | changed - name: Create venv directory on the target host file: path: "{{ venv_destination_path }}" state: directory register: _venv_dir_create - name: Unarchive pre-built venv unarchive: src: "{{ venv_reuse_download_path }}/{{ venv_destination_path | basename }}.tgz" dest: "{{ venv_destination_path }}" remote_src: no when: - (_venv_checksum_copy is mapping and _venv_checksum_copy | changed) or _venv_dir_create | changed notify: - venv changed - name: Update virtualenv python and paths shell: | sed -si '1s/^.*python.*$/#!{{ (venv_destination_path ~ '/bin') | replace ('/','\/') }}\/python/' {{ venv_destination_path }}/bin/* virtualenv {{ venv_destination_path }} when: - (_venv_checksum_copy is mapping and _venv_checksum_copy | changed) or _venv_dir_create | changed tags: - skip_ansible_lint