-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(#3142): several fixes were applied.
Debug tasks removed. New task to check Wazuh components added. The error when setting a variable used to search for failures was fixed.
- Loading branch information
1 parent
880d931
commit 49aceb0
Showing
10 changed files
with
88 additions
and
58 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
tests/end_to_end/basic_cases/test_fim/test_fim_windows/data/playbooks/validation.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
- name: Check supported distros | ||
hosts: centos-manager*,windows-agent* | ||
any_errors_fatal: true | ||
tasks: | ||
|
||
- name: Check if the host distribution is compatible | ||
include_role: | ||
name: host_checker | ||
tasks_from: check_supported_distro | ||
vars: | ||
os: "{{ 'Windows' if ansible_os_family == 'Windows' else 'Linux' }}" | ||
dist: "{{ ansible_distribution if ansible_os_family != 'Windows' else 'Windows' }}" | ||
manager_distros: ['CentOS'] | ||
agent_distros: ['Windows'] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 0 additions & 27 deletions
27
tests/end_to_end/roles/host_checker/tasks/check_connection.yaml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
tests/end_to_end/roles/host_checker/tasks/check_wazuh_components.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# REQUIRED VARIABLES | ||
# ------------------- | ||
# (String) os: Target operating system | ||
|
||
- name: Get Wazuh installation | ||
include_role: | ||
name: service_controller | ||
tasks_from: get_installation_type | ||
|
||
- name: Populate services facts | ||
service_facts: | ||
when: os == 'Linux' | ||
|
||
- name: Check the status of Wazuh components (Manager) | ||
set_fact: | ||
check_result: 'true' | ||
errors: "{{ errors }}{{ ansible_facts.services[item] }} is not running.\n" | ||
when: (os == 'Linux' and 'server' in wazuh_info.stdout and ansible_facts.services[item].state != 'running') | ||
with_items: | ||
- 'wazuh-manager.service' | ||
- 'wazuh-indexer.service' | ||
- 'filebeat.service' | ||
|
||
- set_fact: | ||
service: 'wazuh-agent.service' | ||
when: (os == 'Linux' and 'agent' in wazuh_info.stdout) | ||
|
||
- name: Check the status of Wazuh Agent | ||
set_fact: | ||
check_result: 'true' | ||
errors: "{{ errors }}{{ ansible_facts.services[service].name }} is not running.\n" | ||
when: (os == 'Linux' and 'agent' in wazuh_info.stdout and ansible_facts.services[service].state != 'running') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
# -------- Task to identify whether the validation step fails or not. -------- | ||
- name: Set flag and informative variable | ||
set_fact: | ||
failed: false | ||
errors: null | ||
check_result: 'false' | ||
errors: '' | ||
# ---------------------------------------------------------------------------- | ||
|
||
# -------- Checks ------------------------------------------------------------ | ||
- name: Check host connection | ||
include_tasks: check_connection.yaml | ||
|
||
- name: Check Python | ||
import_tasks: check_python.yaml | ||
|
||
- name: Check OS | ||
import_tasks: check_os.yaml | ||
|
||
- name: Check the status of Wazuh components | ||
import_tasks: check_wazuh_components.yaml | ||
|
||
- name: Check the connection between Filebeat and Wazuh Indexer | ||
import_tasks: check_filebeat_indexer.yaml | ||
|
||
- name: Check the connection between Controller node and Wazuh Indexer | ||
import_tasks: check_controller_indexer.yaml | ||
# ---------------------------------------------------------------------------- | ||
|
||
- debug: var=errors | ||
# -------- Task to identify whether the validation step fails or not. -------- | ||
- name: Verify if any check have failed | ||
fail: | ||
msg: "Some validations were fail:\n'{{ errors }}'" | ||
when: failed == true | ||
when: (check_result == 'true' or errors != '') | ||
# ---------------------------------------------------------------------------- |