Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions etc/kayobe/ansible/wazuh-secrets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,24 @@
path: "{{ wazuh_secrets_path | dirname }}"
state: directory

- name: Check whether wazuh-secrets.yml exists
stat:
path: "{{ wazuh_secrets_path }}"
register: waz_exist_result

- name: Template new secrets
no_log: True
template:
src: wazuh-secrets.yml.j2
dest: "{{ wazuh_secrets_path }}"
when: not waz_exist_result.stat.exists

- name: In-place encrypt wazuh-secrets
no_log: True
copy:
content: "{{ lookup('ansible.builtin.file', wazuh_secrets_path) | ansible.builtin.vault(ansible_vault_password) }}"
dest: "{{ wazuh_secrets_path }}"
decrypt: false
vars:
ansible_vault_password: "{{ lookup('ansible.builtin.env', 'KAYOBE_VAULT_PASSWORD') }}"
when: not waz_exist_result.stat.exists