doc
This commit is contained in:
@@ -7,6 +7,7 @@ SSH_PUBLIC_HOST_KEYS ?= $(SSH_REMOTE_HOSTS) $(SSH_BASTION_HOSTNAME)
|
||||
SSH_PRIVATE_IP_RANGE ?= 10.10.*
|
||||
SSH_REMOTE_HOSTS ?= github.com gitlab.com
|
||||
|
||||
# function ssh-connect: Exec command on remote hosts with tty
|
||||
define ssh-connect
|
||||
$(eval hosts := $(1))
|
||||
$(eval command := $(2))
|
||||
@@ -15,6 +16,7 @@ define ssh-connect
|
||||
$(foreach host,$(hosts),$(call exec,ssh -t -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $(user)@$(host) "$(command)") ||) true
|
||||
endef
|
||||
|
||||
# function ssh-exec: Exec command on remote hosts without tty
|
||||
define ssh-exec
|
||||
$(eval hosts := $(1))
|
||||
$(eval command := $(2))
|
||||
|
||||
@@ -1,18 +1,22 @@
|
||||
##
|
||||
# SSH
|
||||
|
||||
# target ssh: Call ssh-connect with command SHELL
|
||||
.PHONY: ssh
|
||||
ssh: aws-ec2-get-PrivateIpAddress-$(SERVER_NAME)
|
||||
ssh: aws-ec2-get-PrivateIpAddress-$(SERVER_NAME) ## Connect to first remote host
|
||||
$(call ssh-connect,$(AWS_INSTANCE_IP),$(SHELL))
|
||||
|
||||
# target ssh-connect: Call ssh-connect with command make connect
|
||||
.PHONY: ssh-connect
|
||||
ssh-connect: aws-ec2-get-PrivateIpAddress-$(SERVER_NAME)
|
||||
$(call ssh-connect,$(AWS_INSTANCE_IP),make connect $(if $(SERVICE),SERVICE=$(SERVICE)))
|
||||
|
||||
# target ssh-connect: Call ssh-connect with command make exec
|
||||
.PHONY: ssh-exec
|
||||
ssh-exec: aws-ec2-get-PrivateIpAddress-$(SERVER_NAME)
|
||||
$(call ssh-exec,$(AWS_INSTANCE_IP),make exec $(if $(SERVICE),SERVICE=$(SERVICE)) $(if $(ARGS),ARGS='\''"$(ARGS)"'\''))
|
||||
|
||||
# target ssh-run: Call ssh-connect with command make run
|
||||
.PHONY: ssh-run
|
||||
ssh-run: aws-ec2-get-PrivateIpAddress-$(SERVER_NAME)
|
||||
$(call ssh-exec,$(AWS_INSTANCE_IP),make run $(if $(SERVICE),SERVICE=$(SERVICE)) $(if $(ARGS),ARGS='\''"$(ARGS)"'\''))
|
||||
|
||||
Reference in New Issue
Block a user