0
我能夠使用ansible我的應用程序服務器上安裝一些Python模塊。但是,當我包含python-mysqldb
模塊時,它會引發下面的錯誤。的python-MySQLdb的模塊錯誤ansible
[email protected]:~/ansible$ ansible-playbook playbooks/webserver.yml
PLAY [webserver] ***************************************************************
TASK [setup] *******************************************************************
ok: [app02]
ok: [app01]
TASK [install web components] **************************************************
failed: [app02] (item=[u'apache2', u'libapache2-mod-wsgi', u'python-pip', u'python-virtualenv', u'python-mysqldb']) => {"failed": true, "item": ["apache2", "libapache2-mod-wsgi", "python-pip", "python-virtualenv", "python-mysqldb"], "module_stderr": "Shared connection to app02 closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n File \"/tmp/ansible_sYzNC_/ansible_module_apt.py\", line 909, in <module>\r\n main()\r\n File \"/tmp/ansible_sYzNC_/ansible_module_apt.py\", line 892, in main\r\n if updated_cache and not retvals['changed']:\r\nKeyError: 'changed'\r\n", "msg": "MODULE FAILURE"}
failed: [app01] (item=[u'apache2', u'libapache2-mod-wsgi', u'python-pip', u'python-virtualenv', u'python-mysqldb']) => {"failed": true, "item": ["apache2", "libapache2-mod-wsgi", "python-pip", "python-virtualenv", "python-mysqldb"], "module_stderr": "Shared connection to app01 closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n File \"/tmp/ansible_GKrHoN/ansible_module_apt.py\", line 909, in <module>\r\n main()\r\n File \"/tmp/ansible_GKrHoN/ansible_module_apt.py\", line 892, in main\r\n if updated_cache and not retvals['changed']:\r\nKeyError: 'changed'\r\n", "msg": "MODULE FAILURE"}
to retry, use: --limit @/home/vagrant/ansible/playbooks/webserver.retry
PLAY RECAP *********************************************************************
app01 : ok=1 changed=0 unreachable=0 failed=1
app02 : ok=1 changed=0 unreachable=0 failed=1
Ansible劇本:
---
- hosts: webserver
become: true
tasks:
- name: install web components
apt: name={{item}} state=present update_cache=yes
with_items:
- apache2
- libapache2-mod-wsgi
- python-pip
- python-virtualenv
- python-mysqldb
我試圖安裝Apache的應用服務器的MySQL幾個模塊,但這個特殊的模塊,阻止我前進。我現在無能爲力。如果有人能幫助我,那將會很有幫助。
很多預先感謝。
你能手動安裝嗎?沒有Ansible? –
謝謝Quadri,但我不確定如何安裝沒有責任。您可以建議的任何鏈接?我也認爲應用程序服務器存在一些問題,而不是可靠的。 – harshavmb
我認爲這個問題是你instaling包的那其餘的都是Debian軟件包,並通過'的apt-GET'這裏爲'myql-python'是通過'pip'安裝Python包安裝。您可能會看到:http://stackoverflow.com/questions/25865270/how-to-install-python-mysqldb-module-using-pip作爲參考。我不知道* Ansible *,但我很確定問題的原因是我提到的 –