--- # 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: Create venv directories file: path: "{{ repo_build_venv_dir }}" state: "directory" owner: "{{ repo_build_service_user_name }}" mode: 02755 - name: Get venv command path command: which virtualenv changed_when: false register: virtualenv_path - name: Set virtualenv command path set_fact: virtualenv_bin: "{{ virtualenv_path.stdout }}" - name: Create venv build script template: src: "venv-build-script.sh.j2" dest: "/opt/venv-build-script.sh" mode: "0755" register: _create_venv_build_script - name: Create venv build options files template: src: "venv-build-options.txt.j2" dest: "{{ repo_build_release_path }}/venv-build-options-{{ item['role_name'] }}.txt" with_items: "{{ filtered_venv_role_python_requirements }}" register: _create_venv_options_files - name: Execute the venv build scripts asynchonously shell: "/opt/venv-build-script.sh {{ repo_build_release_path }}/venv-build-options-{{ item['item']['role_name'] }}.txt" args: executable: "/bin/bash" when: - (item | changed) or (_create_venv_build_script | changed) or (ansible_local['openstack_ansible']['repo_build']['need_venv_build'] | bool) with_items: - "{{ _create_venv_options_files.results }}" register: _build_venv async: "{{ repo_build_venv_timeout * 60 }}" poll: 0 # This task requires the use of the shell module, so we skip lint # to avoid: # ANSIBLE0013 Use shell only when shell functionality is required tags: - skip_ansible_lint - name: Wait for the venvs builds to complete async_status: jid: "{{ item['ansible_job_id'] }}" register: _venv_jobs until: _venv_jobs['finished'] | bool delay: 10 retries: "{{ repo_build_venv_timeout * 6 }}" with_items: "{{ _build_venv['results'] }}" when: - item['ansible_job_id'] is defined - name: Disable the venv build requirement now that it is complete ini_file: dest: "/etc/ansible/facts.d/openstack_ansible.fact" section: repo_build option: need_venv_build value: False