-
Notifications
You must be signed in to change notification settings - Fork 0
/
base.mk
43 lines (34 loc) · 1.13 KB
/
base.mk
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
DOMAIN ?=
VAGRANT_KEY = ~/.vagrant.d/insecure_private_key
SSH_CONFIG ?= ~/.ssh/config
LIBVIRT_IPAM ?= 192.168.121.*
LOCAL_K8S_DEV := ../scripts/k8s
LOCAL_DOCKER_DEV := ../scripts/docker
REMOTE_K8S := "c:\\k"
REMOTE_DOCKER := "c:\\docker"
define ssh_libvirt
# vagrant libvirt powershell
Host $(LIBVIRT_IPAM)
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null
endef
export ssh_libvirt
.PHONY: up
up:
vagrant up --provider libvirt
.PHONY: destroy
destroy:
vagrant destroy -f
.PHONY: ssh_config_libvirt
ssh_config_libvirt:
@egrep "^# vagrant libvirt powershell" $(SSH_CONFIG) &>/dev/null || echo "$$ssh_libvirt" >> $(SSH_CONFIG)
.PHONY: ps-enter
ps-enter: ssh_config_libvirt
# Copy the enter-pssession command in your pwsh terminal
@ip=$$(sudo virsh domifaddr $(DOMAIN) vnet0 | grep vnet0 | awk '{print $$4}' | cut -d/ -f1); \
echo "enter-pssession -Hostname $$ip -Username vagrant -KeyFilePath $(VAGRANT_KEY)"; \
TERM=xterm pwsh
.PHONY: sync-dev
sync-dev:
../scripts/rsync.sh vagrant $(VAGRANT_KEY) $(DOMAIN) $(LOCAL_K8S_DEV) $(REMOTE_K8S)
../scripts/rsync.sh vagrant $(VAGRANT_KEY) $(DOMAIN) $(LOCAL_DOCKER_DEV) $(REMOTE_DOCKER)