Move ssh and git tasks into dedicated role "ssh"

This commit is contained in:
2025-09-13 02:44:26 +02:00
parent 24327f8eeb
commit 25dc798c0c
2 changed files with 20 additions and 27 deletions

18
roles/ssh/tasks/main.yml Normal file
View File

@@ -0,0 +1,18 @@
- name: Ensure ssh keypair
openssh_keypair:
path: "{{ lookup('env', 'HOME') }}/.ssh/id_ed25519"
type: ed25519
regenerate: full_idempotence
- name: Ensure ssh key on github
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
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 }}"