Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

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
share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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