-
Notifications
You must be signed in to change notification settings - Fork 7
/
remote.bat
57 lines (51 loc) · 1.45 KB
/
remote.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
@echo off
:: configuration options
:: =====================
::
:: PROJECT_FOLDER (default: "%CD%")
:: Absolute path of the Project (containing the Vagrantfile)
:: VAGRANT_ANSIBLE_REMOTE (default: "vagrant_ansible_remote")
:: Relative path of vagrant-ansible-remote to the project
:: --- option defaults ---
if not defined PROJECT_FOLDER (
set "PROJECT_FOLDER=%CD%"
)
if not defined VAGRANT_ANSIBLE_REMOTE (
set "VAGRANT_ANSIBLE_REMOTE=vagrant_ansible_remote"
)
if not defined REMOTE_TYPE (
set "REMOTE_TYPE=vagrant-ssh"
)
:: --- constants ---
if defined ANSICON (
set "RED=[1;31;40m"
set "NORMAL=[0m"
) else (
set RED=
set NORMAL=
)
:: --- check environment ---
if not exist "%PROJECT_FOLDER%" (
echo %RED%PROJECT_FOLDER%NORMAL% is not valid
exit 20
)
if "%VAGRANT_ANSIBLE_REMOTE%." == "" (
echo %RED%VAGRANT_ANSIBLE_REMOTE%NORMAL% is not valid
exit 21
)
if not exist "%PROJECT_FOLDER%/%VAGRANT_ANSIBLE_REMOTE%" (
echo %RED%VAGRANT_ANSIBLE_REMOTE%NORMAL% is not valid
exit 21
)
:: --- load customization ---
if exist "%PROJECT_FOLDER%/.remote.bat" (
call "%PROJECT_FOLDER%/.remote.bat"
)
:: Windows cannot run Ansible therefore we use
if "%REMOTE_TYPE%" == "vagrant-ssh" (
call "%PROJECT_FOLDER%/%VAGRANT_ANSIBLE_REMOTE%/vagrant/ssh-ansible.bat" %*
) else if "%REMOTE_TYPE%" == "docker-run" (
call "%PROJECT_FOLDER%/%VAGRANT_ANSIBLE_REMOTE%/docker/run-ansible.bat" %*
) else (
echo "%RED%REMOTE_TYPE%NORMAL% is not valid (%REMOTE_TYPE%)"
)