我的目录结构是这样的
$ tree
├── Vagrantfile
├── files
│ ├── cmake
│ ├── pip-requirements.txt
│ └── profile
└── tasks
└── main.yml
main.yml
---
- hosts: kurseve
tasks:
- name: Install pip
pip:
requirements: ../files/pip-requirements.txt
virtualenv: /home/vagrant/venvs/cv
virtualenv_python: python2.7
但是当我尝试使用项目根目录中的vagrant up --provision
命令配置Vagrant框时。错误日志显示ansible无法找到放置在pip-requirements.txt
files/
这是错误日志
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"
}
答案 0 :(得分:2)
pip模块期望pip-requirements.txt
文件位于目标框中:
pip要求文件的路径,该文件应该是远程系统的本地文件。如果使用chdir选项,则可以将文件指定为相对路径。
因此,如果您的配置流程没有将您的本地文件夹复制/链接到流浪盒中,则没有NSCoding
可用。