2016-08-02 108 views
0

我試圖通過Ansible在ESXi主機上安裝VM。 我使用的角色和劇本,你可以在這裏看到 - >Deploy a VM via Ansible on ESXi HostAnsible - 需要pysphere模塊

但現在我得到一個錯誤:

[email protected]:~/ansible# ansible-playbook -i Inventory vmware_deploy.yml 

PLAY *************************************************************************** 

TASK [setup] ******************************************************************* 
ok: [172.20.22.5] 

TASK [vmware : vsphere_guest] ************************************************** 
fatal: [172.20.22.5]: FAILED! => {"changed": false, "failed": true, "msg": "pysphere module required"} 

PLAY RECAP ********************************************************************* 
172.20.22.5    : ok=1 changed=0 unreachable=0 failed=1 

所以它似乎是未安裝模塊「pysphere」所以我試着命令「apt-get install pysphere」,但他不能找到任何這樣命名的包(是的,服務器有一個工作的互聯網連接)! 所以你們可能會幫助我如何安裝它? 我希望我的劇本工作的話..:/

親切的問候, kgierman

編輯:

[email protected]:~/ansible# pip2 install pysphere 
Requirement already satisfied (use --upgrade to upgrade): pysphere in /usr/local/lib/python2.7/dist-packages/pysphere-0.1.7-py2.7.egg 

[email protected]:~/ansible# pip3 install pysphere 
The program 'pip3' is currently not installed. You can install it by typing: 
apt install python3-pip 

所以它似乎是,我有安裝了PIP2版本,而不是一個PIP3版本

+0

請出示劇本和任務。 – tedder42

回答

0

如果apt-get install pysphere這意味着這個Python模塊沒有可用的deb包。使用pip代替:

pip install pysphere 

如該軟件包需要在Ansible控制主機上安裝了documentation for the vsphere_guest module指出:

Requirements (on host that executes module)

python >= 2.6 
pysphere 
+0

好吧,我做了這個,但現在我得到followung消息: 'root @ ansible1:〜/ ansible#pip install pysphere 需求已滿意(使用--upgrade升級):pysphere在/ usr/local/lib/python2.7/dist-packages/pysphere-0.1.7-py2.7.egg' 這意味着軟件包已安裝,對不對?但爲什麼包不起作用呢? –

+0

好吧,我編輯了我的問題,這樣你可以更清楚地看到輸出結果 - 這似乎是我安裝了Python2.X版本而不是Python 3版本,所以這可能不是錯誤:/ 我希望你仍然可以幫助我@我的問題 –