myos/make/apps/myos/def.ssh.mk

28 lines
1.2 KiB
Makefile
Raw Normal View History

2021-05-31 03:45:39 +02:00
DOCKER_BUILD_VARS += $(SSH_ENV_VARS)
ENV_VARS += $(SSH_ENV_VARS)
2021-06-12 03:13:01 +02:00
SSH_BASTION_HOSTNAME ?=
SSH_BASTION_USERNAME ?=
2021-05-31 03:45:39 +02:00
SSH_ENV_VARS ?= SSH_BASTION_HOSTNAME SSH_BASTION_USERNAME SSH_PUBLIC_HOST_KEYS SSH_PRIVATE_IP_RANGE
SSH_PUBLIC_HOST_KEYS ?= $(SSH_REMOTE_HOSTS) $(SSH_BASTION_HOSTNAME)
2021-06-12 03:13:01 +02:00
SSH_PRIVATE_IP_RANGE ?=
2021-05-31 03:45:39 +02:00
SSH_REMOTE_HOSTS ?= github.com gitlab.com
2021-06-06 16:29:54 +02:00
# function ssh-connect: Exec command 2 on remote hosts 1 with tty
2021-02-09 17:05:00 +01:00
define ssh-connect
2021-06-12 03:13:01 +02:00
$(call INFO,ssh-connect,$(1)$(comma) $(2)$(comma) $(3))
2021-02-09 17:05:00 +01:00
$(eval hosts := $(1))
$(eval command := $(2))
$(eval user := $(or $(3),root))
$(eval DOCKER_EXEC_OPTIONS := -it)
$(foreach host,$(hosts),$(call exec,ssh -t -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $(user)@$(host) "$(command)") ||) true
endef
2021-06-06 16:29:54 +02:00
# function ssh-exec: Exec command 2 on remote hosts 1 without tty
2021-02-09 17:05:00 +01:00
define ssh-exec
2021-06-12 03:13:01 +02:00
$(call INFO,ssh-exec,$(1)$(comma) $(2)$(comma) $(3))
2021-02-09 17:05:00 +01:00
$(eval hosts := $(1))
$(eval command := $(2))
$(eval user := $(or $(3),root))
$(foreach host,$(hosts),$(call exec,ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $(user)@$(host) "$(command)") &&) true
endef