gpt4 book ai didi

python - 我收到消息 : "The pexpect python module is required" when running pexpect module on ansible

转载 作者:太空宇宙 更新时间:2023-11-03 20:53:02 28 4
gpt4 key购买 nike

我对ansible非常陌生,我正在尝试运行一个剧本来更改主机的root密码,所以我使用pexpect模块的expect命令。我成功地在主机和运行 playbook 的本地服务器上安装了带有 python 2.7 的 pexpect v4.7。然而,当剧本运行时,它失败并出现错误:“需要 pexpect python 模块”

根据要求,pexpect和python版本正确

Files installed on hosts for pexpect and python: 
/usr/lib/python2.7/site-packages/pexpect
/usr/lib/python2.7/site-packages/pexpect-4.7.0-py2.7.egg-info
/usr/pexpect-4.7.0
/usr/pexpect-4.7.0/doc/api/pexpect.rst
/usr/pexpect-4.7.0/pexpect.egg-info
/usr/pexpect-4.7.0/tests/pexpectTest.py
/usr/pexpect-4.7.0/pexpect
/usr/pexpect-4.7.0/build/lib/pexpect

剧本如下:

---
- hosts: all
become: true

tasks:
- name: change password for root user
expect:
command: passwd root
responses:
(?i)password: "password"

我做错了什么吗?请帮忙!

最佳答案

我通过从所有主机中删除 pexpect 然后相应地安装 epel-release、pip 和 pexpect 包来解决这个问题。

关于python - 我收到消息 : "The pexpect python module is required" when running pexpect module on ansible,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56194974/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com