1
votes

Trying to use a playbook with Ansible that uses the synchronize module but I'm getting the error:

Traceback (most recent call last): File "/export/home/webops/.ansible/tmp/ansible-tmp-1433165514.33-173345229349905/synchronize", line 21, in from ansible import utils ImportError: No module named ansible

I get the same error with the copy module. It appears a script is trying to execute on the target machine but it's looking for the Ansible module that doesn't exist on the target host.

I'm not sure how this is supposed to work if the Ansible module isn't installed on all target hosts.

Another time I see the error is when I simply run the command

ansible jscpoama01z5 -m copy -a "src=/etc/hosts dest=/tmp/hosts"

and I get the response

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
You really need to provide some more specifics, like an example of the playbook you are running, specific error messages, how you installed Ansible, etc. if you expect anybody to be able to assist. Without knowing exactly what you are doing and what you are seeing we can only guess at what might be going on. There's no need to install anything (other than python) on the target hosts. Ansible copies modules to the targets as they are run.Bruce P

1 Answers

2
votes

Without more information. I would say ansible is not installed or you have an issue with python virtual environment or your paths are incorrect.

Run this command check if you get error

python -c "import ansible"