I run the same environment and needed ansible to be available to cmd.exe 
(as used by Vagrant).

Having installed ansible via cygwin I created the following files in 
C:\ansible:

ansible-playbook.bat
----------

@echo off
set CYGWIN_BASH_PATH=C:\cygwin\bin\bash
set CYGWIN=nodosfilewarning
for /f "delims=" %%a in ('%CYGWIN_BASH_PATH% -c "echo $PWD"') do @set 
PWD=%%a
"%CYGWIN_BASH_PATH%" -l -c "cd %PWD%; %~n0 %*"


ansible-playbook
----------

#!/bin/sh
CYGWIN_BASH_PATH=/c/cygwin/bin/bash.exe
export CYGWIN=nodosfilewarning
CYGWIN_PWD=$($CYGWIN_BASH_PATH -c "echo \$PWD")
"$CYGWIN_BASH_PATH" -l -c "cd \"$CYGWIN_PWD\"; $(basename "$0") $@"


Optional: you can also create ansible, ansible-doc, ansible-galaxy and 
ansible-pull.

Make sure that your cygwin ansible scripts are loaded in cygwin's path 
before the folder we created above. I use the following in my $HOME/.bashrc 
file:

# cygwin
if [ "$MACHTYPE" == "i686-pc-cygwin" ]; then
  # redefine the /tmp directory
  umount /tmp 2> /dev/null
  mount -o binary,posix=0,user "$USERPROFILE\AppData\Local\Temp" /tmp

  # remove conflicting windows tools from the path
  export PATH=`echo $PATH | tr ':' '\n' \
      | grep -v '/c/Python27' \
      | grep -v '/c/ansible' \
      | tr '\n' ':' | sed -r 's/:$//'`

  # add ansible to the path
  export ANSIBLE=/opt/ansible
  export PATH=$PATH:$ANSIBLE/bin
  export PYTHONPATH=$ANSIBLE/lib
  export ANSIBLE_LIBRARY=$ANSIBLE/library
fi




On Wednesday, 18 September 2013 16:12:55 UTC+1, Dario wrote:
>
> Hello,
>
> I am trying to run Vagrant in combination with Ansible on a Windows 
> machine. As Ansible doesn't have full support under Windows, I am running 
> it in Cygwin, where it runs fine.
>
> However, then I tried to run it through Vagrant and this fails:
>
>
> $Vagrant provision
> [default] Running provisioner: ansible...
> 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.
>
>
> even though running "ansible-playbook" alone is working. What could be the 
> issue?
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to