Missing dependencies when provisioning Ubuntu with Ansible - Developers’ Notes

iRonin IT Team - Experts in software development
developers notes, devops

If you ever get an error while trying to provision an Ubuntu server with Ansible, check whether it’s not a case of a mismatched Python interpreter.

Today we wanted to provision one of our Ubuntu servers with Ansible and got an error: /bin/sh: 1: /usr/bin/python: not found\r\n After a quick search it turned out you need to explicitly provide a path to the python3 interpreter, which is installed by default (instead of the Python 2 version):

[your-server]
ip.ip.ip.ip ansible_user=ubuntu ansible_python_interpreter=/usr/bin/python3

Seems easy, so we did it and retried the playbook. Then we hit another error: Could not find aptitude. Please ensure it is installed. Ubuntu does not come with aptitude by default any more (at least on AWS; on Vagrant the playbook ran fine), and it’s used by Ansible (link to the issue on Github). It turned out we can solve this by defining a pre-task in the playbook to install it:

pre_tasks:
  - name: 'install aplitude'
    raw: sudo apt-get install -y aptitude
    become: true
    become_user: root
    become_method: sudo

Today’s Developers’ Notes were prepared by Łukasz, our Web Application Development Team Leader. Stay tuned, because there’s more where this came from!

Author's Bio
iRonin IT Team

Experts in software development

We are a 100% remote team of software development experts, providing web & mobile application development and DevOps services for international clients.

Similar articles
Comments

Bulletproof your development with remote team augmentation

Read how
This page is best viewed in portrait mode
Our websites and web services use cookies. We use cookies and collected data to enhance your experience, provide additional communication channels, improve marketing materials and enhance our offer. IRONIN SP. Z O.O. SP. K. is committed to protecting all the data that we collect or process in any way, especially data of personal nature. By accepting these terms you agree to our usage of cookies and processing your data, according to our Privacy Policy, and you declare that your browser settings reflect your preferences. Read more You have the right to revoke this agreement at any time, based on the terms of our Privacy Policy. You can change cookies settings in your browser. If you do not agree with us using cookies and processing your data, please change your cookies settings in your web browser and reject these terms. You can find more information about cookies, your data privacy This site uses cookies. By continuing to browse the site, you are agreeing to our use of cookies. data processing, and your rights in our Privacy Policy.