feat: add playbook to generate credentials before deploying

This commit is contained in:
Bertrand Lanson 2024-05-03 00:30:54 +02:00
parent 1a83036506
commit 489f9aa101

View File

@ -0,0 +1,31 @@
---
# hashistack generate certificates playbook
- name: "Generate credentials"
hosts: localhost
strategy: linear
gather_facts: true
become: true
tasks:
- name: "Generate consul credentials"
block:
- name: "Generate consul root credentials"
ansible.builtin.set_fact:
_consul_root_token: "{{ lookup('uuid', namespace='00000000-0000-0000-0000-000000000000') }}"
- name: "Generate consul agents credentials"
ansible.builtin.set_fact:
_consul_agents_token: "{{ lookup('uuid', namespace='00000000-0000-0000-0000-000000000000') }}"
- name: "Generate nomad credentials"
block:
- name: "Generate nomad root credentials"
ansible.builtin.set_fact:
_nomad_root_token: "{{ lookup('uuid', namespace='00000000-0000-0000-0000-000000000000') }}"
- name: "Write credentials file"
ansible.builtin.template:
src: credentials.yml.j2
dest: credentials.yml
mode: '0644'
- fail: