6

It seems that Vagrant doesn't let me automatically provision the Ansible provisioner on Windows using Vmware.

I'm not really sure whether Ansible has to be installed on the host machine, (in my case Windows) or on the guest.

I tried to automatically provision the guest machine with the following shell script:

#!/usr/bin/env bash

apt-get update -y
apt-get install openssh-client openssh-server python-pycurl software-properties-common python-software-properties nano -y

sleep 2

echo "deb http://ppa.launchpad.net/rquillo/ansible/ubuntu precise main" >> /etc/apt/sources.list
echo "deb-src http://ppa.launchpad.net/rquillo/ansible/ubuntu precise main" >> /etc/apt/sources.list

sleep 2

apt-get install ansible -y

Which installs Ansible perfectly fine but my command prompt tells me the following message:

The executable ansible-playbook Vagrant is trying to run was not found in the %PATH% variable

Upon inspecting the guest and trying to execute 'ansible-playbook' it recognized the command perfectly fine.

Then I thought maybe Vagrant requires 'ansible-playbook' in the path environment variable of the guest.

I ran the following command to add 'ansible-playbook' to my PATH variable on my linux guest machine.

export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/ruby/bin/:ansible-playbook

Also didn't work.

Which draws me to the conclusion that Ansible needs to be installed on the host, because %PATH% also looks like it's required on windows.

And since Ansible is currently not available for Windows, I probably can't use Ansible on a Windows host.

Am I correct in my assumptions, or am I missing something?

6

I've had success installing Ansible (and subsequently running a playbook) onto a new Vagrant guest with the following bash script (tested with Ubuntu 13.04):

#!/usr/bin/env bash

export DEBIAN_FRONTEND=noninteractive

apt-get update -qq
apt-get install -y make git-core

if [[ ! -d /home/vagrant/ansible ]]; then
    # Install Ansible dependencies.
    apt-get install -y python-mysqldb python-yaml python-jinja2 python-paramiko sshpass

    # Checkout the Ansible repository.
    git clone https://github.com/ansible/ansible.git /home/vagrant/ansible

    mkdir /etc/ansible

    echo "localhost" > /etc/ansible/hosts

    source /home/vagrant/ansible/hacking/env-setup
    echo "source /home/vagrant/ansible/hacking/env-setup" >> /home/vagrant/.bashrc
fi

cd /srv/vagrant
ansible-playbook playbook.yml
  • You mean a Vagrant Ubuntu guest machine? Are you running a Windows or Ubuntu host? – Hyperfocus Sep 24 '13 at 9:37
  • Sorry, yes, on the guest. This appears to work on OSX, Windows, and Ubuntu hosts - we have all three and needed a way to provision a dev box for everyone. – ceejayoz Sep 24 '13 at 14:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.