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:
22
main.yml
22
main.yml
@@ -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 }}"
|
||||
|
||||
Reference in New Issue
Block a user