document how to set up secrets using SOPS for a new host

This commit is contained in:
June 2025-05-04 00:11:43 +02:00
parent eb70df37f1
commit 66e2e354b1
Signed by: june
SSH key fingerprint: SHA256:o9EAq4Y9N9K0pBQeBTqhSDrND5E7oB+60ZNx0U1yPe0
2 changed files with 17 additions and 0 deletions

View file

@ -24,6 +24,8 @@ SOPS verschlüsselt hier die Secrets nach den "creation rules", welche in der `s
Grundsätzlich werden hier alle Secrets für alle GPG-Keys aller Mitglieder des Infra-Teams verschlüsselt.
Das eigentliche Laden der Secrets durch Ansible geschieht mit Hilfe des `community.sops.sops` lookup Plugins, welches entsprechend den lokalen GPG-Key benutzt, um die Secrets zu entschlüsseln.
For a tutorial on how to set up secrets using SOPS for a new host, see [Setting Up Secrets Using SOPS for a New Host](./docs/setting_up_secrets_using_sops_for_a_new_host.md).
## Playbook nur für einzelne Hosts ausführen
Ein paar der Hosts haben den selben Namen, was es etwas schwieriger macht, das Playbook nur für einen der Hosts auszuführen, z. B. `public-reverse-proxy`. Die Kombination aus `--inventory` und `--limit` führt zum Erfolg:

View file

@ -0,0 +1,15 @@
# Setting Up Secrets Using SOPS for a New Host
1. Add a new creation rule for the hosts resources directory.
It should probably hold all admin keys.
You can use existing creation rules as a reference.
2. Create a file containing the relevant secrets in the hosts resources directory.
This can be accomplished with a command similar to this:
```
sops resources/[chaosknoten|z9]/HOSTNAME/secrets.yaml
```
3. In the following an example on how to then use the `community.sops.sops` lookup plugin to use a secret for a host.
In this particular instance the lookup plugin gets used to set the `nextcloud__postgres_password` variable in an inventories `host_vars` file to the secret value of the `DB_PASSWORD` YAML key:
```yaml
nextcloud__postgres_password: "{{ lookup('community.sops.sops', 'resources/chaosknoten/cloud/secrets.yaml', extract='[\"DB_PASSWORD\"]') }}"
```