0

I'm writing a script to redeploy code onto the intel edison through ansible. When running the following command I get an error. If possible I'd like to know how to find the file locally that causes this issue. I think that the file that throws the error on the server, "/home/root/.ansible/tmp/ansible-tmp-1444631867.66-245111051532005/setup", is probably generated from the files in the local repo.

However, I can't seem to find this setup file in ansible locally, and ansible removes this file from the server(edison) after the error gets thrown.

$ ansible-playbook -i inventory.yml provision_edison.yml

failed: [192.168.1.196] => {"failed": true, "parsed": false}
Traceback (most recent call last):
  File "/home/root/.ansible/tmp/ansible-tmp-1444631867.66-245111051532005/setup", line 196, in <module>
import syslog
ImportError: No module named syslog
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011

My inventory file inventory.yml

[edisons]
192.168.1.196

My provision_edison.yml file

 ---
 - hosts: edisons
   remote_user: root
   tasks:
     - name: "test if stuff is working"
       shell: uname -a

I recoginise this as a python import error that is happening on the server. I tried seeing if the line number that the server threw, 196, corresponds to a file I have locally, but no luck.

 root@edison-01:/usr/bin# ./python
 Python 2.7.3 (default, Aug 15 2014, 22:34:09) 
 [GCC 4.8.2] on linux2
 Type "help", "copyright", "credits" or "license" for more information.
 >>> import syslog
 Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
 ImportError: No module named syslog
avemw
  • 3
  • 3
  • [`syslog`](https://docs.python.org/2/library/syslog.html) is Python's standard module. Ensure that you have it on your server. E.g. `ssh` to your server, run `python` and run `import syslog` in the interpreter. If it fails, you have to investigate why it's not available. – Yaroslav Admin Oct 12 '15 at 16:05

2 Answers2

0

Something about your Python environment must be off. syslog has been a part of the standard library since at least 2.6. Is this a unix-based machine? Is this a clean installation of Python? I would check things like your Python path as well as see if you can import other standard libraries on that box.

Dan
  • 1,925
  • 3
  • 22
  • 28
  • I've tried importing syslog on a Windows machine and got the same error as you. I know you probably wouldn't be running `uname -a` if this was a Windows machine, but... are you running this on Windows? – Dan Oct 12 '15 at 22:05
  • I'm running this on an intel edison, The operating system is called yocto. http://www.intel.com/content/www/us/en/do-it-yourself/edison.html – avemw Oct 13 '15 at 03:34
  • I've edited my question to have the output of the import statement. I fixed the syslog problem by installing conda, and numpy. conada installed a new python that had syslog. sadly I'm still not sure how to run ansible because any new intel edison board will have the python without syslog. – avemw Oct 13 '15 at 03:49
0

A number of one-off Python builds don't include the syslog library, even though it's technically part of the core. This issue should be fixed in Ansible 2.0 by the following commit: https://github.com/ansible/ansible/commit/c57200925f7fc3c77da9a0b671ef7328cad15d8d

nitzmahone
  • 13,720
  • 2
  • 36
  • 39