Ansible 2.2 import MD5 issue

I’ve recently installed first Ansible 2.2 by cloning the source to my Ubuntu 14.04 host as per http://docs.ansible.com/ansible/intro_installation.html#latest-releases-via-apt-ubuntu

The install went fine after running

source ./hacking/env-setup

vagrant@box01:/vagrant/ANSIBLE/RTR-TEMPLATE$ ansible --version
ansible 2.2.0 (devel ed7623ecde) last updated 2016/07/12 15:18:46 (GMT +000)
lib/ansible/modules/core: (detached HEAD db8af4c5af) last updated 2016/07/12 15:18:53 (GMT +000)
lib/ansible/modules/extras: (detached HEAD 482b1a640e) last updated 2016/07/12 15:19:03 (GMT +000)
config file =
configured module search path = Default w/o overrides
vagrant@box01:/vagrant/ANSIBLE/RTR-TEMPLATE$

However when I try to run a very simple playbook that creates some template files that runs on different host with Ansible 1.9.4 it errors with following :

vagrant@box01:/vagrant/ANSIBLE/RTR-TEMPLATE$ ansible-playbook site.yml -i test -v
No config file found; using defaults

PLAY [Generate router configuration files] *************************************

TASK [router : Generate configuration files] ***********************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ImportError: cannot import name md5s
fatal: [tor01.a01]: FAILED! => {“failed”: true, “msg”: “Unexpected failure during module execution.”, “stdout”: “”}
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ImportError: cannot import name md5s
fatal: [tor01.a02]: FAILED! => {“failed”: true, “msg”: “Unexpected failure during module execution.”, “stdout”: “”}
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ImportError: cannot import name md5s
fatal: [tor01.a05]: FAILED! => {“failed”: true, “msg”: “Unexpected failure during module execution.”, “stdout”: “”}

NO MORE HOSTS LEFT *************************************************************
to retry, use: --limit @site.retry

PLAY RECAP *********************************************************************
tor01.a01 : ok=0 changed=0 unreachable=0 failed=1
tor01.a02 : ok=0 changed=0 unreachable=0 failed=1
tor01.a05 : ok=0 changed=0 unreachable=0 failed=1

vagrant@box01:/vagrant/ANSIBLE/RTR-TEMPLATE$

vagrant@box01:/vagrant/ANSIBLE/RTR-TEMPLATE$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.

from ansible.utils import md5s
Traceback (most recent call last):
File “”, line 1, in
ImportError: cannot import name md5s

Not sure if this means I’m missing some dependency that Ansible-playbook relies on ?

I’ve recently installed first Ansible 2.2 by cloning the source to my Ubuntu 14.04 host as per http://docs.ansible.com/ansible/intro_installation.html#latest-releases-via-apt-ubuntu

The install went fine after running

source ./hacking/env-setup

vagrant@box01:/vagrant/ANSIBLE/RTR-TEMPLATE$ ansible --version
ansible 2.2.0 (devel ed7623ecde) last updated 2016/07/12 15:18:46 (GMT +000)
lib/ansible/modules/core: (detached HEAD db8af4c5af) last updated 2016/07/12 15:18:53 (GMT +000)
lib/ansible/modules/extras: (detached HEAD 482b1a640e) last updated 2016/07/12 15:19:03 (GMT +000)
config file =
configured module search path = Default w/o overrides
vagrant@box01:/vagrant/ANSIBLE/RTR-TEMPLATE$

However when I try to run a very simple playbook that creates some template files that runs on different host with Ansible 1.9.4 it errors with following :

vagrant@box01:/vagrant/ANSIBLE/RTR-TEMPLATE$ ansible-playbook site.yml -i test -v
No config file found; using defaults

PLAY [Generate router configuration files] *************************************

TASK [router : Generate configuration files] ***********************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ImportError: cannot import name md5s
fatal: [tor01.a01]: FAILED! => {“failed”: true, “msg”: “Unexpected failure during module execution.”, “stdout”: “”}
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ImportError: cannot import name md5s
fatal: [tor01.a02]: FAILED! => {“failed”: true, “msg”: “Unexpected failure during module execution.”, “stdout”: “”}
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ImportError: cannot import name md5s
fatal: [tor01.a05]: FAILED! => {“failed”: true, “msg”: “Unexpected failure during module execution.”, “stdout”: “”}

NO MORE HOSTS LEFT *************************************************************
to retry, use: --limit @site.retry

PLAY RECAP *********************************************************************
tor01.a01 : ok=0 changed=0 unreachable=0 failed=1
tor01.a02 : ok=0 changed=0 unreachable=0 failed=1
tor01.a05 : ok=0 changed=0 unreachable=0 failed=1

vagrant@box01:/vagrant/ANSIBLE/RTR-TEMPLATE$

vagrant@box01:/vagrant/ANSIBLE/RTR-TEMPLATE$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.

from ansible.utils import md5s
Traceback (most recent call last):
File “”, line 1, in
ImportError: cannot import name md5s

This import should be “from ansible.utils.hashing import md5s” I just checked the source on the version you have checked out and the code is being imported in plugins/filter/core.py and it is importing from that location. So it should be finding the correct library. Will be interesting to see whether doing that at the python prompt works.

You can also run ansible-playbook with -vvvv to get more information about where the error is occurring.

Not sure if this means I’m missing some dependency that Ansible-playbook relies on ?

I wouldn’t expect so for this particular error (md5 itself is implemented in python’s standard library and the import error says that we can’t import ansible’s code). The two things that better fit the symptoms are the git checkout somehow not having the correct files or the Pythonpath not being setup to use the correct ansible library. The output of -vvvv should help figure out the latter.

-Toshio