deploy.sh: auto-refresh SSH host key when h4a recreates the VM
This commit is contained in:
parent
1d7574e0b2
commit
fa7a205eb7
1 changed files with 4 additions and 1 deletions
|
|
@ -12,7 +12,10 @@ set -euo pipefail
|
|||
ALIAS="thuisbatterij"
|
||||
APP_DIR="/opt/thuisbatterij"
|
||||
|
||||
echo "→ checking SSH"
|
||||
echo "→ checking SSH (auto-refreshing host key if h4a recreated the VM)"
|
||||
HOST=$(awk -v a="${ALIAS}" '$1=="Host"{h=$2} h==a&&$1=="HostName"{print $2; exit}' "${HOME}/.ssh/config")
|
||||
ssh-keygen -R "${HOST}" >/dev/null 2>&1 || true
|
||||
ssh-keyscan -t ed25519,rsa "${HOST}" 2>/dev/null >> "${HOME}/.ssh/known_hosts"
|
||||
ssh -o BatchMode=yes -o ConnectTimeout=8 ${ALIAS} 'true'
|
||||
|
||||
echo "→ rsyncing source to ${ALIAS}:${APP_DIR}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue