2024-05-02 22:30:54 +00:00
|
|
|
---
|
|
|
|
# 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:
|
2024-05-03 20:27:42 +00:00
|
|
|
_consul_root_token: "{{ lookup('password', '/dev/null chars=ascii_letters,digits') | to_uuid }}"
|
2024-05-02 22:30:54 +00:00
|
|
|
|
|
|
|
- name: "Generate consul agents credentials"
|
|
|
|
ansible.builtin.set_fact:
|
2024-05-03 20:27:42 +00:00
|
|
|
_consul_agents_token: "{{ lookup('password', '/dev/null chars=ascii_letters,digits') | to_uuid }}"
|
2024-05-02 22:30:54 +00:00
|
|
|
|
|
|
|
- name: "Generate nomad credentials"
|
|
|
|
block:
|
|
|
|
- name: "Generate nomad root credentials"
|
|
|
|
ansible.builtin.set_fact:
|
2024-05-03 20:27:42 +00:00
|
|
|
_nomad_root_token: "{{ lookup('password', '/dev/null chars=ascii_letters,digits') | to_uuid }}"
|
2024-05-02 22:30:54 +00:00
|
|
|
|
|
|
|
- name: "Write credentials file"
|
|
|
|
ansible.builtin.template:
|
2024-05-03 20:27:42 +00:00
|
|
|
src: templates/credentials.yml.j2
|
|
|
|
dest: "{{ sub_configuration_directories['secrets'] }}/{{ configuration_credentials_vars_file }}"
|
|
|
|
owner: "{{ lookup('env', 'USER') }}"
|
|
|
|
group: "{{ lookup('env', 'USER') }}"
|
2024-05-02 22:30:54 +00:00
|
|
|
mode: '0644'
|
|
|
|
|
2024-05-03 20:27:42 +00:00
|
|
|
# - fail:
|