create_ssh_key¶
Generates a dedicated SSH keypair on the server (~/.ssh/id_rsa for
username). Run once during initial provisioning.
What it does¶
- Generates an SSH keypair at
~/.ssh/id_rsaif one doesn't already exist (openssh_keypairis idempotent — a second run is a no-op). - Registers the result as the
create_ssh_key_public_keyfact, in case a caller wants to consumecreate_ssh_key_public_key.public_keyin a later task (nothing in this repo currently does).
Variables¶
None.
Requirements/notes¶
- Currently generates a key that isn't consumed by any deploy role in
this repo:
fastapi_backendandreact_frontendboth authenticate theirgit cloneover HTTPS with a GitHub Personal Access Token instead (see the root README's "GitHub Token" section and each role's own README). - Kept around for the SSH-based alternative: if you'd rather clone over
SSH than manage a token, register this key as a read-only GitHub
Deploy Key on the target repo — see the root README's "GitHub
Deploy Key" section for the exact steps (
sshin,cat ~/.ssh/id_rsa.pub, add it under Settings > Deploy Keys).
Example¶
# setup.yml
- hosts: all
vars:
username: spigushe
roles:
- role: create_ssh_key