Search code examples
pythonpipansiblepypi

Ansible Pip Install python modules into vendor subdirectory using '--target'


What is the Ansible pip module equalant of 'pip install --target vendor' ? Is 'virtualenv=' is the right choice to achieve this? Thanks!

- name: Download calibre-web dependencies into vendor subdirectory.
  command: pip install --target vendor -r ./requirements.txt
  args:
      chdir: /install/directory

Solution

  • You could make use of the extra_args option of the pip module. Please refer to example below

    - name: install to vendor directory
      pip:
        requirements: requirements.txt
        chdir: /install/directory
        extra_args: --target vendor