首页 文章

Ansible复制和同步模块失败:没有名为ansible的模块

提问于
浏览
0

试图使用一个使用同步模块的Ansible的剧本,但我收到错误:

回溯(最近一次调用最后一次):文件“/export/home/webops/.ansible/tmp/ansible-tmp-1433165514.33-173345229349905/synchronize”,第21行,来自ansible import utils 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
}

1 回答

  • 2

    没有更多信息 . 我会说ansible没有安装,或者你有python虚拟环境的问题或你的路径不正确 .

    运行此命令检查是否出现错误

    python -c“import ansible”

相关问题