I am setting up an Ansible server to manage my other servers. Unfortunately on two of them I got the following error message:

fatal: [server1.programster.org]: FAILED! => {"changed": false, "module_stderr": "Shared connection to server1.programster.org closed.\r\n", "module_stdout": "/bin/sh: 1: /usr/bin/python: not found\r\n", "msg": "MODULE FAILURE", "rc": 0}

I noticed that which python output nothing, and I was able to "fix" the situation by creating a symlink of /usr/bin/python that pointed to /usr/bin/python3.

Was there a "more correct" way to fix this than me creating symlinks? I know Ubuntu 16.04 dropped python2 for python3 but I would have thought it would come out of the box with /usr/bin/python pointing to python3 no?

  • AFAIK the changeover to python3 as the default doesn't occur until 18.04 - see for example Python on Ubuntu - the "more correct" fix for 16.04 would be to symlink to /usr/bin/python2.7 (or possibly to re-install the python-minimal package) – steeldriver Mar 12 '18 at 18:08
  • Thats wierd. These AWS deployed ubuntu 16.04 instances appear to have python 3 and not 2. I need to dig deeper to see what is going on. – Programster Mar 12 '18 at 19:49

No, /usr/bin/python is never supposed to point to python3. It sounds like the script in question is broken, and a bug should be reported.

| improve this answer | |
  • Or, alternative to being "broken", this Ansible script may be set to run Python2 and not Python3, and OP should install Python 2 on their endpoint systems that are giving issues. – Thomas Ward Mar 12 '18 at 17:55
  • I'm installing ansible from the PPA on ubuntu 16.04 which gives me ansible which appears to expect the client machines to have /usr/bin/python set up. I guess I need to report this to the ansible guys as dobey states. – Programster Mar 12 '18 at 19:46
  • double checked, and aws instances are deploying with python3 and not python2, but reading on stack overflow, it looks like one can tell ansible to use python3 interpreter instead which feels like the most optimal solution: stackoverflow.com/questions/32429259/… – Programster Mar 12 '18 at 20:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.