wazuh-ansible icon indicating copy to clipboard operation
wazuh-ansible copied to clipboard

Installation fails when sensible option inject_facts_as_vars = False

Open GregWhiteyBialas opened this issue 2 years ago • 1 comments

Hi.

By default, Ansible injects a variable for every fact, prefixed with ansible_. This can result in a large number of variables for each host, which at scale can incur a performance penalty. Ansible provides a configuration option link that can be set to False to prevent this injection of facts. In this case, facts should be referenced via ansible_facts..

When this option is set to "False" deploying Wazuh using roles fails with: `fatal: [wazuh-master]: FAILED! => msg: |- The conditional check 'ansible_os_family == 'RedHat'' failed. The error was: error while evaluating conditional (ansible_os_family == 'RedHat'): 'ansible_os_family' is undefined

The error appears to be in '/home/ubuntu/src/kayobe-config/etc/kayobe/ansible/roles/wazuh-ansible/wazuh-ansible/roles/wazuh/wazuh-indexer/tasks/RedHat.yml': line 4, column 5, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


  - name: RedHat/CentOS/Fedora | Add Wazuh indexer repo
    ^ here

`

This issue can Sheed some light and give context why to use inject_facts_as_vars = False in the first place.

I have created PR to solve this. If something needs more clarification don't hesitate to ask.

I am not sure if this approach to creating issue and creating PR is correct (in terms of interacting with community), so if anything should be done differently let me know :)

GregWhiteyBialas avatar Feb 10 '23 14:02 GregWhiteyBialas

Hi @GregWhiteyBialas. Thanks for the contribution. Can you change the base branch of the PR from master to 4.4, please? I will test the changes and review the PR next week.

teddytpc1 avatar Mar 10 '23 13:03 teddytpc1