Add ability to create ssh-keys and provide it to github and gitea

Here we start to have some delicate secrets in the code. Therefore I
need a vault for ansible. This vault contains the tokens to upload
ssh-keys to github and my lovely gitea server.

Note, that this change also adds a `requirements.yml`, this is necessary
because I use the paramater "api_url" of the github_key resource which
was only added in v11, but the debian ansible was shippped with an older
collection.
This commit is contained in:
2025-09-12 21:33:04 +02:00
parent c405e31f76
commit 34226a6d6d
7 changed files with 54 additions and 0 deletions

View File

@@ -18,3 +18,25 @@
url: "{{ fly_url }}"
dest: "{{ lookup('env', 'HOME') }}/.local/bin/fly"
mode: "u=rwx,g=rx,o=rx"
- name: Ensure ssh keypair
tags: [ssh]
openssh_keypair:
path: "{{ lookup('env', 'HOME') }}/.ssh/id_ed25519"
type: ed25519
regenerate: full_idempotence
- name: Ensure ssh key on github
tags: [ssh,git]
github_key:
name: "{{ lookup('env', 'USER') }}@{{ hostname }}"
token: "{{ github_token }}"
pubkey: "{{ lookup('file', lookup('env', 'HOME') ~ '/.ssh/id_ed25519.pub') }}"
- name: Ensure ssh key on gitea
tags: [ssh, git]
github_key:
name: "{{ lookup('env', 'USER') }}@{{ hostname }}"
token: "{{ gitea_token }}"
pubkey: "{{ lookup('file', lookup('env', 'HOME') ~ '/.ssh/id_ed25519.pub') }}"
api_url: "{{ gitea_api_url }}"