Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ubuntu 16.04 requires Python 2 #82

Closed
stevepiercy opened this issue May 22, 2017 · 4 comments
Closed

Ubuntu 16.04 requires Python 2 #82

stevepiercy opened this issue May 22, 2017 · 4 comments

Comments

@stevepiercy
Copy link
Contributor

Ubuntu 16.04 requires Python 2 installed for this playbook to run.

On Digital Ocean, I did the following:

  • create a droplet of Ubuntu 16.04.2 x32
  • add a new user for sudo and SSH
  • followed the docs to set up the playbook
  • issued following command with response:
(ansible_work) Steves-iMac:ansible-playbook stevepiercy$ ansible XXX.stevepiercy.us -a "whoami"
XXX.stevepiercy.us | FAILED! => {
    "changed": false,
    "failed": true,
    "module_stderr": "Shared connection to ###.###.###.### closed.\r\n",
    "module_stdout": "/bin/sh: 1: /usr/bin/python: not found\r\n",
    "msg": "MODULE FAILURE",
    "rc": 0
}

A quick search led me to SO posts a-plenty, but I couldn't decide which looked the best for automation. Instead I just installed Python 2 via SSH with sudo apt-get install python-simplejson. Now the command works:

(ansible_work) Steves-iMac:ansible-playbook stevepiercy$ ansible XXX.stevepiercy.us -a "whoami"
XXX.stevepiercy.us | SUCCESS | rc=0 >>
spiercy

I hang my head in shame for not automating gooder.

I also saw an issue in the tracker that mentioned this, and it seems that it got overlooked in the subsequent PRs.
#16
#17
#43

@stevepiercy
Copy link
Contributor Author

Thank you!

@mmorejon
Copy link

mmorejon commented Dec 6, 2017

Once installed python-simplejson, ansible worked perfectly!
Thank you!

@tkimnguyen
Copy link
Sponsor Member

as per 9499e4b indeed

which python2.7

then

sudo apt-get install -y python

made my old plone.io branch work again :) thx @smcmahon (and @stevepiercy for filing the bug that I was looking for!)

@emmanuelstroem
Copy link

Because Ubuntu 16.04 and above come with python3,
you need to first set the python3 path in your hosts file like this:
ansible_python_interpreter=/usr/bin/python3
for the initial run of the playbook to install python-simplejson which installs python2 or just python.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants