【发布时间】:2017-05-08 10:51:18
【问题描述】:
我正在尝试使用 ansible 来部署我们的系统。我在 yml 文件中使用了 expect 模块并尝试使用ansible-playbook 运行它并得到了这个错误:
致命:[192.168.100.132]:失败! => {“改变”:假,“失败”: true, "msg": "pexpect python 模块是必需的"}
然后我从 pypi.python.org 下载了 pexpect-4.2.1 包并通过“python setup.py install”安装它。 但它不起作用,错误永远不会改变。 我应该怎么处理这个错误?
来自 yml 文件的一些代码:
- name: auth root
expect:
command: mysql_secure_installation
responses:
'Enter password for user root:': '{{password.stdout}}'
'New password:': 'dtise123'
'Re-enter new password:': 'dtise123'
'Do you wish to continue with the password provided\?\(Press y\|Y for Yes, any other key for No\) :': 'y'
'Remove anonymous users\? \(Press y\|Y for Yes, any other key for No\) :': 'y'
'Disallow root login remotely\? \(Press y\|Y for Yes, any other key for No\) :': 'y'
'Remove test database and access to it\? \(Press y\|Y for Yes, any other key for No\) :': 'y'
'Reload privilege tables now\? \(Press y\|Y for Yes, any other key for No\) :': 'y'
echo: yes
我从 pypi.python.org 下载了 pexpect-4.2.1.tar.gz 并这样做了:
mv pexpect-4.2.1.tar.gz /usr/local/src/
cd /usr/local/src
tar zxvf pexpect-4.2.1.tar.gz
cd pexpect-4.2.1
python setup.py install
【问题讨论】:
-
你在哪里安装了 pexpect?
-
我在问题中添加了答案。请帮助我!
-
当我问在哪里时,我的意思是在哪台机器上。
-
对不起。我将它安装在 ansible 主机上。我需要在每个节点机器上安装它吗?