Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luisdelarosa/323447a0574250865ea149c4a4a839b7 to your computer and use it in GitHub Desktop.
Save luisdelarosa/323447a0574250865ea149c4a4a839b7 to your computer and use it in GitHub Desktop.
Get Ansible to work on bare Ubuntu 16.04 without python 2.7
# Add this snippet to the top of your playbook. We'll refer to this as "your-playbook.yml"
# It will install python2 if missing (but checks first so no expensive repeated apt updates)
# gwillem@gmail.com
# Assumes that you are not running as root
# Run via: "ansible-playbook --ask-become-pass your-playbook.yml"
# v1.1 by luis@luisdelarosa.com / @louielouie
- hosts: all
gather_facts: False
tasks:
- name: install python 2
become: true
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment