Skip to content

Commit 8f22f3b

Browse files
committed
Use .ssh/config to setup SSH proxy jump
Unfortunately, my previous attempt to route deployment through a jumphost[^1] doesn't work. Turns out that specifying a proxyjump host inline doesn't support specifying an SSH key to authenticate with. It worked well on my machine because some _default_ key was used transparently, but it fails on CD where no such key exist. The new approach tries to address the problem by moving away from inline SSH configuration towards the .ssh/config file, which has everything needed specified. [^1]: 7aec773
1 parent 1312406 commit 8f22f3b

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

.github/workflows/cd.yaml

+12-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: CD
22

33
on:
44
push:
5-
branches: [master]
5+
branches: [master, bug/cd-fixes]
66
workflow_dispatch:
77

88
jobs:
@@ -37,10 +37,20 @@ jobs:
3737
# Ensure that servers we're deploying to are known. Otherwise,
3838
# Ansible may fail with host key verification error.
3939
mkdir -p ~/.ssh && echo "${{ secrets.SSH_KNOWN_HOSTS }}" >> ~/.ssh/known_hosts
40+
cat <<EOF > ~/.ssh/config
41+
Host _jumphost
42+
User bunny
43+
HostName hoth.kalnytskyi.com
44+
IdentityFile ${{ steps.ssh-key.outputs.uri }}
45+
46+
Host xsnippet.org
47+
HostName 2a02:8084:4:e480:244a:d5a5:ac59:617d
48+
ProxyJump _jumphost
49+
IdentityFile ${{ steps.ssh-key.outputs.uri }}
50+
EOF
4051
4152
ansible-playbook \
4253
-vv \
43-
-e ansible_ssh_private_key_file="${{ steps.ssh-key.outputs.uri }}" \
4454
-e goaccess_basicauth_password="${{ secrets.GOACCESS_PASSWORD }}" \
4555
--inventory inventories/production \
4656
site.yml

inventories/production/hosts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
[xsnippet]
2-
2a02:8084:4:e480:244a:d5a5:ac59:617d
2+
xsnippet.org
33

44
[xsnippet:vars]
55
ansible_user = provisioner
6-
ansible_ssh_common_args = -J bunny@hoth.kalnytskyi.com

0 commit comments

Comments
 (0)