myos/make/apps/myos/ssh.mk

27 lines
1.1 KiB
Makefile
Raw Normal View History

2021-02-09 17:05:00 +01:00
##
# SSH
2021-06-06 16:29:54 +02:00
# target get-PrivateIpAddress-%: Fire aws-ec2-get-instances-PrivateIpAddress-%
.PHONY: get-PrivateIpAddress-%
get-PrivateIpAddress-%: aws-ec2-get-instances-PrivateIpAddress-%;
# target ssh: Call ssh-connect ARGS or SHELL
2021-02-09 17:05:00 +01:00
.PHONY: ssh
2021-06-06 16:29:54 +02:00
ssh: get-PrivateIpAddress-$(SERVER_NAME) ## Connect to first remote host
$(call ssh-connect,$(AWS_INSTANCE_IP),$(if $(ARGS),$(ARGS),$(SHELL)))
2021-02-09 17:05:00 +01:00
2021-06-06 16:29:54 +02:00
# target ssh-connect: Call ssh-connect make connect SERVICE
2021-02-09 17:05:00 +01:00
.PHONY: ssh-connect
2021-06-06 16:29:54 +02:00
ssh-connect: get-PrivateIpAddress-$(SERVER_NAME)
2021-02-09 17:05:00 +01:00
$(call ssh-connect,$(AWS_INSTANCE_IP),make connect $(if $(SERVICE),SERVICE=$(SERVICE)))
2021-06-06 16:29:54 +02:00
# target ssh-exec: Call ssh-exec make exec SERVICE ARGS
2021-02-09 17:05:00 +01:00
.PHONY: ssh-exec
2021-06-06 16:29:54 +02:00
ssh-exec: get-PrivateIpAddress-$(SERVER_NAME)
2021-02-09 17:05:00 +01:00
$(call ssh-exec,$(AWS_INSTANCE_IP),make exec $(if $(SERVICE),SERVICE=$(SERVICE)) $(if $(ARGS),ARGS='\''"$(ARGS)"'\''))
2021-06-06 16:29:54 +02:00
# target ssh-run: Call ssh-run make run SERVICE ARGS
2021-02-09 17:05:00 +01:00
.PHONY: ssh-run
2021-06-06 16:29:54 +02:00
ssh-run: get-PrivateIpAddress-$(SERVER_NAME)
2021-02-09 17:05:00 +01:00
$(call ssh-exec,$(AWS_INSTANCE_IP),make run $(if $(SERVICE),SERVICE=$(SERVICE)) $(if $(ARGS),ARGS='\''"$(ARGS)"'\''))