talas-group/04_INFRA_DEPLOIEMENT/Ansible/roles/postgres-explain-visualizer/tasks/secrets.yml
senke 66471934af Initial commit: Talas Group project management & documentation
Knowledge base of ~80+ markdown files across 14 domains (00-13),
Logseq graph, hardware design files (KiCAD), infrastructure configs,
and talas-wiki static site.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 20:10:41 +02:00

20 lines
843 B
YAML

---
# file: roles/postgres-explain-visualizer/tasks/secrest.yml
- name: "handle secret {{ secret }}"
block:
- name: "get {{ secret }} from hashicorp vault"
set_fact:
"{{ secret }}": "{{ lookup('hashi_vault', 'secret=cosium-kv/data/' + host_vars_location + '/' + ansible_hostname)[secret] }}"
rescue:
- name: "generate a random password for {{ secret }}"
set_fact:
password: "{{ lookup('password','/dev/null chars=ascii_letters,digits length=50') }}"
- name: "patching hashicorp vault with generated {{ secret }}"
delegate_to: localhost
become: no
command: "vault kv patch cosium-kv/{{ host_vars_location }}/{{ ansible_hostname }} {{ secret }}={{ password }}"
- name: "assign password value to {{ secret }}"
set_fact:
"{{ secret }}": "{{ password }}"
tags: pev