hcp-ansible/playbooks/generate_credentials.yml

32 lines
1017 B
YAML
Raw Normal View History

---
# 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: