petermac-
10/29/2014 - 7:37 PM

Running Ansible on Windows

Running Ansible on Windows

@echo off

set COMMAND=%1

REM If you used the standard Cygwin installer this will be C:\cygwin
set CYGWIN=%USERPROFILE%\.babun\cygwin

REM You can switch this to work with bash with %CYGWIN%\bin\bash.exe
set SH=%CYGWIN%\bin\zsh.exe

if not exist "%SH%" (
    echo cygwin's sh.exe not found. Did you delete %CYGWIN% ?
    exit /b 255
)

"%SH%" -c "[[ -x "%COMMAND%" ]]"
if not errorlevel 0 (
    echo %COMMAND% not found. Did you uninstall it ?
    exit /b 255
)

"%SH%" -c "%*"
@echo off

cygwin-shim.bat /bin/ansible-playbook %*
@echo off

cygwin-shim.bat /bin/ansible-galaxy %*