From 1df3ef86993ec125c51b1d15fb20078f92867beb Mon Sep 17 00:00:00 2001 From: neonmei Date: Mon, 23 Nov 2020 11:38:07 -0300 Subject: [PATCH] roles/agent: for registration rename check_keys->client_keys_file for more clarity, update conditionals length checks to explicit "yes" check --- roles/wazuh/ansible-wazuh-agent/tasks/Linux.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/roles/wazuh/ansible-wazuh-agent/tasks/Linux.yml b/roles/wazuh/ansible-wazuh-agent/tasks/Linux.yml index 9c2eb825..8b8d9314 100644 --- a/roles/wazuh/ansible-wazuh-agent/tasks/Linux.yml +++ b/roles/wazuh/ansible-wazuh-agent/tasks/Linux.yml @@ -41,8 +41,7 @@ - name: Linux | Check if client.keys exists stat: path: /var/ossec/etc/client.keys - register: check_keys - when: wazuh_agent_config.enrollment.enabled == 'yes' + register: client_keys_file tags: - config @@ -97,18 +96,18 @@ vars: agent_name: "{% if single_agent_name is defined %}{{ single_agent_name }}{% else %}{{ ansible_hostname }}{% endif %}" when: - - not check_keys.stat.exists or check_keys.stat.size == 0 + - not client_keys_file.stat.exists or client_keys_file.stat.size == 0 - wazuh_agent_authd.registration_address is not none - name: Linux | Verify agent registration - shell: echo {{ agent_auth_output }} | grep "Valid key created" + shell: echo {{ agent_auth_output }} | grep "Valid key received" when: - - not check_keys.stat.exists or check_keys.stat.size == 0 + - not client_keys_file.stat.exists or client_keys_file.stat.size == 0 - wazuh_agent_authd.registration_address is not none when: - - wazuh_agent_authd.enable - - not wazuh_agent_config.enrollment.enabled | length > 0 or wazuh_agent_config.enrollment.enabled == 'no' + - wazuh_agent_authd.enable | bool + - wazuh_agent_config.enrollment.enabled != 'yes' tags: - config - authd