2017-01-13 38 views
1

在這個例子中,Django-cities失敗。Pips通過Ansible Playbook安裝特定的git commit失敗

- hosts: localhost 
    tasks: 
    - name: Install Django 
    pip: name=Django 
    - name: Install Userena 
    pip: name=django-userena 
    - name: Install Django Messages 
    pip: name=https://github.com/arneb/django-messages/archive/master.zip 
    - name: Install Django Cities 
    pip: name=git+https://github.com/coderholic/[email protected] 

錯誤:

TASK [Install Django Cities] *************************************************** 
fatal: [localhost]: FAILED! => {"changed": false, "cmd": "/usr/bin/pip2 install -e git+https://github.com/coderholic/[email protected]", 
"failed": true, "msg": "\n:stderr: --editable=git+https://github.com/coderholic/[email protected] is not the right format; it must have #egg=Package\nYou are using pip version 8.1.2, however version 9.0.1 is available.\nYou should consider upgrading via the 'pip install --upgrade pip' command.\n"} 
    to retry, use: --limit @/root/cannablr/ansible/playbooks/installdjango.retry 

是安裝一個混蛋通過PIP在Ansible不允許犯?

回答

1

,如果你在命令行運行此你會得到同樣的錯誤:

$ pip install -e git+https://github.com/coderholic/[email protected] 
--editable=git+https://github.com/coderholic/[email protected] is not the right format; it must have #egg=Package 

您可以將#egg=packagename添加到它,它會工作:

$ pip install -e git+https://github.com/coderholic/[email protected]#egg=django-cities 
Obtaining django-cities from git+https://github.com/coderholic/[email protected]#egg=django-cities 
    Cloning https://github.com/coderholic/django-cities.git (to d0163f393e7557914b3f2c6882e740537ca63fd6) to src/django-cities 

所以只需添加#egg=django-cities到Ansible的URL,你會很好。

注意我建議引用你的git+https://....#egg=xyz yaml。那裏有很多魔法角色。