diff --git a/defaults/main.yml b/defaults/main.yml index 2751467..fbd3e27 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -76,12 +76,6 @@ venv_reuse_build_wheels: yes # prevent re-use of venvs between them. venv_reuse_download_venv_path: "{{ lookup('env', 'HOME') | default('/opt', true) }}/cache/venvs/{{ venv_reuse_download_subfolder }}" -# The path where built wheels should be stored on the -# deployment host. By default, ensure that the location -# separates wheels per distribution and architecture to -# prevent reuse of wheels between them. -venv_reuse_download_wheel_path: "{{ lookup('env', 'HOME') | default('/opt', true) }}/cache/wheels/{{ venv_reuse_download_subfolder }}" - # NOTE(hwoarang): ansible_distribution may return a string with spaces # such as "openSUSE Leap" so we need to replace the space with underscore # in order to create a more sensible repo name for the distro. @@ -92,7 +86,7 @@ venv_reuse_download_path_owner: "{{ lookup('env', 'USER') | default('root', true # The path where the wheels are cached on the target host # for speeding up the build process. -venv_wheel_destination_path: "/var/cache/pip/wheels" +venv_wheel_destination_path: "/var/cache/python_wheels" # The facts to set when the venv changes during a # build, or the installation of a venv. diff --git a/tasks/python_venv_build.yml b/tasks/python_venv_build.yml index 71631a8..89ab355 100644 --- a/tasks/python_venv_build.yml +++ b/tasks/python_venv_build.yml @@ -44,33 +44,15 @@ - "{{ venv_destination_path }}" - "{{ venv_wheel_destination_path }}" -- name: Build and synchronize wheels when venv_reuse_build_wheels is enabled +- name: Build wheels for the packages to be installed into the venv + command: >- + pip wheel + --wheel-dir {{ venv_wheel_destination_path }}/ + --find-links {{ venv_wheel_destination_path }}/ + --log /var/log/python_wheel_build.log + {{ venv_pip_install_args }} + {{ venv_pip_packages | join(' ') }} when: venv_reuse_build_wheels | bool - block: - - - name: Copy any existing wheels to the target host for re-use - synchronize: - src: "{{ venv_reuse_download_wheel_path }}/" - dest: "{{ venv_wheel_destination_path }}" - owner: no - group: no - - - name: Build wheels for the packages to be installed into the venv - command: >- - pip wheel - --wheel-dir {{ venv_wheel_destination_path }}/ - --find-links {{ venv_wheel_destination_path }}/ - --log /var/log/python_wheel_build.log - {{ venv_pip_install_args }} - {{ venv_pip_packages | join(' ') }} - - - name: Copy any new wheels from the target host to the deploy host for re-use - synchronize: - mode: pull - src: "{{ venv_wheel_destination_path }}/" - dest: "{{ venv_reuse_download_wheel_path }}" - owner: no - group: no #TODO(odyssey4me): # Split the venv build into multiple parts: diff --git a/tasks/python_venv_preflight.yml b/tasks/python_venv_preflight.yml index 586331f..a1f9b01 100644 --- a/tasks/python_venv_preflight.yml +++ b/tasks/python_venv_preflight.yml @@ -32,16 +32,13 @@ - venv_reuse_build_only | bool - not venv_reuse_enable | bool -- name: Ensure that venv_reuse paths exists on the deployment host +- name: Ensure that venv_reuse_download_path exists on the deployment host file: - path: "{{ item }}" + path: "{{ venv_reuse_download_venv_path }}" state: directory owner: "{{ venv_reuse_download_path_owner }}" delegate_to: localhost run_once: yes - with_items: - - "{{ venv_reuse_download_venv_path }}" - - "{{ venv_reuse_download_wheel_path }}" when: - venv_reuse_enable | bool diff --git a/tests/test-functional.yml b/tests/test-functional.yml index 86f1517..811e15e 100644 --- a/tests/test-functional.yml +++ b/tests/test-functional.yml @@ -28,7 +28,7 @@ - path: "{{ lookup('env', 'HOME') | default('/opt', true) }}/cache/venvs" - path: "{{ lookup('env', 'HOME') | default('/opt', true) }}/cache/wheels" condition: "{{ target_host_group_name == 'test1' }}" - - path: "/var/cache/pip" + - path: "/var/cache/python_wheels" - name: Clean up facts from previous tests ini_file: