Quantcast
Channel: User kaiser - Server Fault
Viewing all articles
Browse latest Browse all 26

Ansible not found in PATH after installation on Vagrant box

$
0
0

The Problem

For a test, I set up a very simple Vagrant file. This is just to test how working with Ansible is. Sadly I am stuck at step number 2 with the following error during vagrant up --provision (which I can repeat on reload):

The executable 'ansible-playbook' Vagrant is trying to run was not found in the PATH variable. This is an error. Please verify this software is installed and on the path.


The Debugging Efforts so far

As the Ubuntu 14 "Trusty" 64bit box comes without Ansible installed, I added a quick shell script to run as provisioner before the actual Ansible playbooks. Here's the Vagrantfile

Vagrant.require_version ">= 1.7.0"Vagrant.configure("2") do |config|    config.vm.box = "ubuntu/trusty64"    config.ssh.insert_key = false    # Synced folders    config.vm.synced_folder "./public", "/var/www",        disabled: false    # Install Ansible    config.vm.provision :shell,        path: "provisioners/shell/install-ansible.sh"    # Run Ansible Playbooks    config.vm.provision "ansible" do |ansible|        ansible.verbose = "vvv"        ansible.playbook = "provisioners/ansible/playbook.yml"    endend

The bash script install-ansible.sh is as simple as this:

sudo apt-get install software-properties-commonsudo apt-add-repository ppa:ansible/ansiblesudo apt-get -y updatesudo apt-get install ansible

To confirm that ansible-playbook and ansible are installed, I vagrant sshed into the box and called which ansible-playbook and which ansible. Both are available:

$ which ansible# /usr/bin/ansible

Looking at dpkg -L ansible, I find plenty of stuff going on in /etc and /usr/bin. Also python --version gives me Python 2.7.6 while the minimum required version is 2.4.

The echo $PATH gives the following default output:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

I can confirm, that the user is the correct one: whoami results in vagrant and the last command executed before the error is:

PYTHONUNBUFFERED=1 ANSIBLE_HOST_KEY_CHECKING=false ANSIBLE_FORCE_COLOR=true ANSIBLE_SSH_ARGS='-o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s'ansible-playbook     --user=vagrant     --connection=ssh     --timeout=30     --limit='default'    --inventory-file=/Users/*****/projects/*****/.vagrant/provisioners/ansible/inventory         -vvv         provisioners/ansible/playbook.yml

I am out of ideas here.


Viewing all articles
Browse latest Browse all 26

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>