python-使用ansible的mysqldb模块错误
python-mysqldb module error using ansible
我可以使用 ansible 在我的应用服务器上安装几个 python 模块。但是,当我包含 python-mysqldb
模块时,它会抛出以下错误。
vagrant@control:~/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 模块,但这个特定模块阻碍了我前进。我一时不知所措。如果有人能帮助我,那将是很大的帮助。
非常感谢。
进一步调试应用服务器后,我知道了根本原因。
应用程序服务器无法连接到远程存储库。当我使用 vag运行t ubuntu 框时,我 运行 使用以下命令关闭防火墙。
sudo ufw disable
它可能不是组织内 ubuntu 框的可行选项,因为它们受防火墙策略约束。
我可以使用 ansible 在我的应用服务器上安装几个 python 模块。但是,当我包含 python-mysqldb
模块时,它会抛出以下错误。
vagrant@control:~/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 模块,但这个特定模块阻碍了我前进。我一时不知所措。如果有人能帮助我,那将是很大的帮助。
非常感谢。
进一步调试应用服务器后,我知道了根本原因。
应用程序服务器无法连接到远程存储库。当我使用 vag运行t ubuntu 框时,我 运行 使用以下命令关闭防火墙。
sudo ufw disable
它可能不是组织内 ubuntu 框的可行选项,因为它们受防火墙策略约束。