My directory structure is something like this
$ tree
├── Vagrantfile
├── files
│ ├── cmake
│ ├── pip-requirements.txt
│ └── profile
└── tasks
└── main.yml
Contents of main.yml
---
- hosts: kurseve
tasks:
- name: Install pip
pip:
requirements: ../files/pip-requirements.txt
virtualenv: /home/vagrant/venvs/cv
virtualenv_python: python2.7
But when I try to provision the Vagrant box using the command vagrant up --provision
from the project root. The error log shows that ansible was not able to find the pip-requirements.txt
placed inside the files/
This is the error log
fatal: [kurseve]: FAILED! => {
"changed": false,
"cmd": "/home/vagrant/venvs/cv/bin/pip2 install -r ../files/pip-requirements.txt",
"failed": true,
"invocation": {
"module_args": {
"chdir": null,
"editable": true,
"executable": null,
"extra_args": null,
"name": null,
"requirements": "../files/pip-requirements.txt",
"state": "present",
"umask": null,
"use_mirrors": true,
"version": null,
"virtualenv": "/home/vagrant/venvs/cv",
"virtualenv_command": "virtualenv",
"virtualenv_python": "python2.7",
"virtualenv_site_packages": false
},
"module_name": "pip"
},
"msg": "\n:stderr: Could not open requirements file: [Errno 2] No such file or directory: '../files/pip-requirements.txt'\n"
}
pip module expect requirements
file to be on the target box:
The path to a pip requirements file, which should be local to the remote system. File can be specified as a relative path if using the chdir option.
So if your provisioning process doesn't copy/link your local folder into vagrant box, there is no pip-requirements.txt
available.