I'm provisioning a Vagrant box (ubuntu/trusty64) with Ansible.
When executing the following playbook:
---
- hosts: all
tasks:
- name: install pip
easy_install:
name: pip
state: present
- name: install gunicorn and flask
pip: name={{ item }}
with_items:
- gunicorn
- flask
I'm receiving the error below:
Failed to find required executable easy_install in paths
Searching for a solution I found this stackoverflow thread which point on the fact that using easy_install
is outdated.
I haven't found any hints in the Ansible easy_install docs.
Any help will be appreciated.
My Vagrantfile:
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network "forwarded_port", guest: 80, host: 8080
config.vm.provision :ansible do |ansible|
ansible.playbook = "playbook.yml"
end
end
Running with:
Ansible 2.7.10.
Vagrant 2.0.2.
Full Stacktrace of the error mentioned:
TASK [install pip]
fatal: [default]: FAILED! => {"changed": false, "msg": "Failed to find required executable easy_install in paths: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"} to retry, use: --limit @/home/workspaces/python_flask/playbook.retry
PLAY RECAP
Simply transforming my comment as an answer.
easy_install
is simply not installed on your base vagrant box or not found in the configured path. Although it's an outdated method to install python packages, the module still exists.
If you install easy_install
on your base vagrant box (either by rebuilding it or while provisioning with ansible as an apt
task), the error will go away.
Meanwhile, if you have a recent box with python already installed (which seems to be the case), there are lots of chances pip
is already there and you can skip your first task.