Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent double encryption #1176

Open
wants to merge 4 commits into
base: stackhpc/2023.1
Choose a base branch
from
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