C.W.K.
Stream
Lesson 02 of 14 · published

SSH Config Mastery for Fleets

~15 min · ssh-config, host-lists, groups

Level 0Pinger
0 XP0/101 lessons0/12 achievements
0/150 XP to next level150 XP to go0% complete

The foundation

Track 3 built your ~/.ssh/config. Fleet management lives on top of it. Every script, every loop, every Ansible playbook works because ssh hostname just works — no flags, no IPs, consistent settings.

Group hosts in config files

Plain text host lists turn the SSH config into a fleet inventory. Keep them in ~/.fleet/ or your dotfiles repo: one file per logical group, one host per line. Every fleet tool can read these — shell loops, pssh, even Ansible.

Code

Fleet-ready ~/.ssh/config·ssh-config
# Workstations
Host office
    HostName 192.168.1.10
    User you_username
Host server
    HostName 192.168.1.11
    User you_username
Host music
    HostName 192.168.1.12
    User you_username
Host worker
    HostName 192.168.1.13
    User you_username

# Portables
Host macbook
    HostName 192.168.1.20
    User you_username
Host pro2024
    HostName 192.168.1.21
    User you_username
Host pro2023
    HostName 192.168.1.22
    User you_username
Host mini
    HostName 192.168.1.30
    User you_username

# Tailscale (Track 6)
Host ts-*
    User you_username

Host *
    AddKeysToAgent yes
    UseKeychain yes
    IdentityFile ~/.ssh/id_ed25519
    ServerAliveInterval 60
    ControlMaster auto
    ControlPath ~/.ssh/sockets/%r@%h-%p
    ControlPersist 10m
Host lists (~/.fleet/)·bash
# ~/.fleet/all.txt
office
server
music
worker
macbook
pro2024
pro2023
air
mini

# ~/.fleet/workstations.txt
office
server
music
worker

# ~/.fleet/laptops.txt
macbook
pro2024
pro2023
air

Exercise

Make sure your ~/.ssh/config matches the structure above (Host * at the bottom, ControlMaster enabled, etc.). Then create ~/.fleet/all.txt with every host alias. Add ~/.fleet/workstations.txt and ~/.fleet/laptops.txt for subsets. Five-minute investment, years of payoff.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.