Skip to content

Commit

Permalink
refactor(infra): increase ssh connection persistence to 1h
Browse files Browse the repository at this point in the history
  • Loading branch information
mrekucci committed Jul 5, 2024
1 parent 3e104d4 commit f4e0e33
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/infrastructure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,23 @@ jobs:
- name: Configure Control Machine
run: |
mkdir -p ~/.ssh
chmod 700 ~/.ssh
cat <<EOF >> ~/.ssh/config
Host *
ControlMaster auto
ControlPath /tmp/ssh_mux_%h_%p_%r
ControlPersist 10m
EOF
ANSIBLE_USER="${USER}"
ANSIBLE_CONNECTION="ansible_connection=local"
if [ "${IS_MANUAL_DEPLOYMENT}" == "true" ]; then
ANSIBLE_USER="ubuntu"
ANSIBLE_CONNECTION=""
export ANSIBLE_HOST_KEY_CHECKING=false
mkdir -p ~/.ssh && \
chmod 700 ~/.ssh && \
echo "${{ secrets.INFRASTRUCTURE_DEPLOYMENT_KEY }}" > ~/.ssh/id_ed25519 && \
echo "${{ secrets.INFRASTRUCTURE_DEPLOYMENT_KEY }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
fi
Expand Down
4 changes: 3 additions & 1 deletion infrastructure/nomad/ansible.cfg.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ timeout = 10
connection = ssh
pipelining = True
host_key_checking = False
ssh_args = -o ControlMaster=auto -o ControlPersist=60s -o ForwardAgent=yes
fact_caching = jsonfile
fact_caching_connection = /tmp/ansible_facts_cache
fact_caching_timeout = 86400
Expand All @@ -17,3 +16,6 @@ module_defaults:
gather_subset:
- '!all'
- 'min'

[ssh_connection]
ssh_args = -o ControlMaster=auto -o ControlPersist=60m -o ControlPath=/tmp/ssh_mux_%h_%p_%r -o ForwardAgent=yes

0 comments on commit f4e0e33

Please sign in to comment.