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

Fixing wazuh pr 2.x #1449

Merged
merged 11 commits into from
Feb 20, 2024
4 changes: 2 additions & 2 deletions roles/debian/wazuh/tasks/install.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
- name: Import elastic-stack.
ansible.builtin.import_role:
name: "contrib/{{ wazuh_path }}/roles/elastic-stack/ansible-kibana"
name: "contrib/{{ _wazuh_path }}/roles/elastic-stack/ansible-kibana"

- name: Import opendistro.
ansible.builtin.import_role:
name: "contrib/{{ wazuh_path }}/roles/opendistro/opendistro-kibana"
name: "contrib/{{ _wazuh_path }}/roles/opendistro/opendistro-kibana"

- name: Generate certificates.
ansible.builtin.import_role:
Expand Down
20 changes: 12 additions & 8 deletions roles/debian/wazuh/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
---
# Assumes you have run the ce_provision role on your controller and it has already installed the Wazuh roles
- name: Select items with URL https://github.com/wazuh/wazuh-ansible.git
set_fact:
wazuh_items: "{{ ce_provision.contrib_roles | selectattr('repo', 'equalto', 'https://github.com/wazuh/wazuh-ansible.git') | list }}"
ansible.builtin.set_fact:
_wazuh_items: "{{ ce_provision.contrib_roles | selectattr('repo', 'equalto', 'https://github.com/wazuh/wazuh-ansible.git') | list }}"

- name: Set wazuh path
set_fact:
wazuh_path: "{{ wazuh_items.directory }}"
when: wazuh_items | length > 0
- name: Debug print _wazuh_items
ansible.builtin.debug:
msg: "{{ _wazuh_items }}"

- name: Set wazuh path based on matching repo
ansible.builtin.set_fact:
_wazuh_path: "{{ _wazuh_items | map(attribute='directory') | first }}"
when: _wazuh_items | length > 0

- name: Include task to install based on selected items
include_tasks: install.yml
when: wazuh_items | length > 0
ansible.builtin.include_tasks: install.yml
when: _wazuh_items | length > 0