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

Allow wazuh-single playbook to run in check mode #929

Closed
wants to merge 1 commit into from
Closed
Changes from all 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
Allow wazuh-single playbook to run in check mode
Several steps in the wazuh install process are not 'check mode safe' by
default, this changeset skips them when ansible-playbook is run with --check.
goetzk committed Jun 5, 2023
commit 1d8e7dc4725700ee0c99252a098f5cd5ad443a0f
2 changes: 2 additions & 0 deletions roles/wazuh/wazuh-indexer/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -109,6 +109,7 @@
tags: debug
when:
- hostvars[inventory_hostname]['private_ip'] is not defined or not hostvars[inventory_hostname]['private_ip']
- not ansible_check_mode

- name: Wait for Wazuh indexer API (Private IP)
uri:
@@ -128,6 +129,7 @@
tags: debug
when:
- hostvars[inventory_hostname]['private_ip'] is defined and hostvars[inventory_hostname]['private_ip']
- not ansible_check_mode

- import_tasks: "RMRedHat.yml"
when: ansible_os_family == "RedHat"
8 changes: 6 additions & 2 deletions roles/wazuh/wazuh-indexer/tasks/security_actions.yml
Original file line number Diff line number Diff line change
@@ -60,7 +60,9 @@
replace: "{{ indexer_password_hash | quote }}"
vars:
indexer_password_hash: "{{ indexer_admin_password_hashed.stdout_lines | last }}"

when:
- not ansible_check_mode

# this can also be achieved with password_hash, but it requires dependencies on the controller
- name: Hash the kibanaserver role/user pasword
shell: |
@@ -76,7 +78,9 @@
replace: "{{ indexer_password_hash | quote }}"
vars:
indexer_password_hash: "{{ indexer_kibanaserver_password_hashed.stdout_lines | last }}"

when:
- not ansible_check_mode

- name: Initialize the Opensearch security index in Wazuh indexer
command: >
sudo -u wazuh-indexer OPENSEARCH_PATH_CONF={{ indexer_conf_path }}