【发布时间】:2015-08-15 00:21:36
【问题描述】:
尝试在 Ansible 中使用使用同步模块的剧本,但出现错误:
Traceback(最近一次调用最后一次): 文件“/export/home/webops/.ansible/tmp/ansible-tmp-1433165514.33-173345229349905/synchronize”, 第 21 行,在 从 ansible 导入工具 ImportError: 没有名为 ansible 的模块
复制模块出现同样的错误。似乎一个脚本正试图在目标机器上执行,但它正在寻找目标主机上不存在的 Ansible 模块。
如果没有在所有目标主机上安装 Ansible 模块,我不确定这应该如何工作。
我看到错误的另一次是我只是运行命令时
ansible jscpoama01z5 -m copy -a "src=/etc/hosts dest=/tmp/hosts"
我得到了回应
jscpoama01z5 | FAILED >> {
"checksum": "e71285e7f55bd4cdbae3c4ae4880e601185ce8d0",
"failed": true,
"msg": "couldn't set locale correctly\r\ncouldn't set locale correctly\r\nTraceback (most recent call last):\r\n **File \"/export/home/jlofshul/.ansible/tmp/ansible-tmp-1433187268.02-101408000415252/copy\", line 21, in <module>\r\n from ansible import utils\r\nImportError: No module named ansible**\r\nOpenSSH_6.6, OpenSSL 1.0.1l 15 Jan 2015\r\ndebug1: Reading configuration data /export/home/webops/.ssh/config\r\ndebug1: Reading configuration data /etc/opt/csw/ssh/ssh_config\r\ndebug1: /etc/opt/csw/ssh/ssh_config line 20: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug1: mux_client_request_session: master session id: 2\r\nShared connection to jscpoama01z5 closed.\r\n",
"parsed": false
}
【问题讨论】:
-
如果您希望任何人能够提供帮助,您确实需要提供一些更详细的信息,例如您正在运行的 playbook 示例、具体的错误消息、您如何安装 Ansible 等。在不确切知道你在做什么和你看到什么的情况下,我们只能猜测可能发生的事情。无需在目标主机上安装任何东西(除了 python)。 Ansible 在运行时将模块复制到目标。
标签: python ansible ansible-playbook