Skip to content

Commit 1778696

Browse files
authored
refactor(infra): increase ssh connection persistence to 1h (#203)
1 parent 9a5f741 commit 1778696

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

.github/workflows/infrastructure.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,16 +131,23 @@ jobs:
131131
132132
- name: Configure Control Machine
133133
run: |
134+
mkdir -p ~/.ssh
135+
chmod 700 ~/.ssh
136+
cat <<-EOH >> ~/.ssh/config
137+
Host *
138+
ControlMaster auto
139+
ControlPath /tmp/ssh_mux_%h_%p_%r
140+
ControlPersist 60m
141+
EOH
142+
134143
ANSIBLE_USER="${USER}"
135144
ANSIBLE_CONNECTION="ansible_connection=local"
136145
if [ "${IS_MANUAL_DEPLOYMENT}" == "true" ]; then
137146
ANSIBLE_USER="ubuntu"
138147
ANSIBLE_CONNECTION=""
139148
export ANSIBLE_HOST_KEY_CHECKING=false
140149
141-
mkdir -p ~/.ssh && \
142-
chmod 700 ~/.ssh && \
143-
echo "${{ secrets.INFRASTRUCTURE_DEPLOYMENT_KEY }}" > ~/.ssh/id_ed25519 && \
150+
echo "${{ secrets.INFRASTRUCTURE_DEPLOYMENT_KEY }}" > ~/.ssh/id_ed25519
144151
chmod 600 ~/.ssh/id_ed25519
145152
fi
146153

infrastructure/nomad/ansible.cfg.example

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ timeout = 10
88
connection = ssh
99
pipelining = True
1010
host_key_checking = False
11-
ssh_args = -o ControlMaster=auto -o ControlPersist=60s -o ForwardAgent=yes
1211
fact_caching = jsonfile
1312
fact_caching_connection = /tmp/ansible_facts_cache
1413
fact_caching_timeout = 86400
@@ -17,3 +16,6 @@ module_defaults:
1716
gather_subset:
1817
- '!all'
1918
- 'min'
19+
20+
[ssh_connection]
21+
ssh_args = -o ControlMaster=auto -o ControlPersist=60m -o ControlPath=/tmp/ssh_mux_%h_%p_%r -o ForwardAgent=yes

0 commit comments

Comments
 (0)