diff --git a/defaults/main.yml b/defaults/main.yml index 81896a7..dbbe88e 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -60,6 +60,10 @@ venv_pip_install_args: "" # re-use the venv in subsequent deployments. venv_reuse_enable: yes +# Enable the ability to *only* do the build, so that +# the deploy host can be pre-populated with the venvs. +venv_reuse_build_only: no + # The path where a built venv should be stored on the # deployment host. By default, ensure that the location # separates venvs per distribution and architecture to diff --git a/tasks/main.yml b/tasks/main.yml index 8868993..784fc4f 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -25,8 +25,10 @@ - include_tasks: "python_venv_install.yml" when: - venv_reuse_enable | bool + - not venv_reuse_build_only | bool - _src_venv_present.stat.exists | bool - include_tasks: "python_venv_set_facts.yml" when: + - not venv_reuse_build_only | bool - venv_facts_when_changed != [] diff --git a/tasks/python_venv_preflight.yml b/tasks/python_venv_preflight.yml index fd9bdc1..19b72a4 100644 --- a/tasks/python_venv_preflight.yml +++ b/tasks/python_venv_preflight.yml @@ -21,6 +21,17 @@ when: - venv_destination_path is not defined +- name: Verify that venv_reuse_enable and venv_reuse_build_only are not interfering with each other + fail: + msg: | + If venv_reuse_build_only is enabled, then venv_reuse_enable must also + be enabled. + The variable venv_reuse_enable is set to {{ venv_reuse_enable }}. + The variable venv_reuse_build_only is set to {{ venv_reuse_build_only }}. + when: + - venv_reuse_build_only | bool + - not venv_reuse_enable | bool + - name: Ensure that venv_reuse_download_path exists on the deployment host file: path: "{{ venv_reuse_download_path }}"