5

Using Ansible on Ubuntu 16.04 When which python Fails

 3 years ago
source link: https://fuzzyblog.io/blog/ansible/2017/06/20/using-ansible-on-ubuntu-16-04-when-which-python-fails.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Using Ansible on Ubuntu 16.04 When which python Fails

Jun 20, 2017

Ansible is my favorite devops tool. I've used Chef extensively and despite my Ruby background, well, I hated it. I've slutted around with TerraForm; I've played with Puppet and I've put Salt on my food and servers but time in and time out, I always come back to Ansible. I even like Ansible enough that I wrote about it recently on a Quora post.

One of the beautiful things about Ansible is that it does not require a server side agent. Ansible works via SSH purely and that means that as long as you can login to the server then you can use Ansible to provision it, update it, deploy stuff, etc.

I just deployed my first ever Ubuntu 16.04 LTS box on AWS the other day and one of my surprises was that a which python failed. Oy vey. This means that you can't use Ansible without installing Python – or so I thought. Happily a bit of googling and I discovered the ansible_python_interpreter option which lets you override the default of Python 2 and use Python 3. This gets, oddly, embedded in the inventories file:

[web]
site1 ansible_ssh_host=foo.com

[web:vars]
ansible_python_interpreter=/usr/bin/python3

The way to interpret this is all boxes in the [web] group use the /usr/bin/python3 executable.


Posted In: #ansible #devops


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK