Files
dev-machine/main.yml
Felix Nehrke 34226a6d6d 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.
2025-09-12 21:37:47 +02:00

43 lines
1.2 KiB
YAML

---
- hosts: localhost
roles:
- role: roles/macos
tags: [macos]
when: ansible_os_family == 'Darwin'
- role: roles/debian
tags: [debian]
when: ansible_os_family == 'Debian'
tasks:
- name: Dump hostvars
tags: [never, dump]
debug:
var: hostvars[inventory_hostname]
- name: Ensure fly
tags: [packages]
get_url:
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 }}"