roles/agent: for registration rename check_keys->client_keys_file for more clarity, update conditionals length checks to explicit "yes" check

This commit is contained in:
neonmei 2020-11-23 11:38:07 -03:00
parent a28837a74d
commit 1df3ef8699
No known key found for this signature in database
GPG Key ID: 7EA1832E7E17237E

View File

@ -41,8 +41,7 @@
- name: Linux | Check if client.keys exists - name: Linux | Check if client.keys exists
stat: stat:
path: /var/ossec/etc/client.keys path: /var/ossec/etc/client.keys
register: check_keys register: client_keys_file
when: wazuh_agent_config.enrollment.enabled == 'yes'
tags: tags:
- config - config
@ -97,18 +96,18 @@
vars: vars:
agent_name: "{% if single_agent_name is defined %}{{ single_agent_name }}{% else %}{{ ansible_hostname }}{% endif %}" agent_name: "{% if single_agent_name is defined %}{{ single_agent_name }}{% else %}{{ ansible_hostname }}{% endif %}"
when: 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 - wazuh_agent_authd.registration_address is not none
- name: Linux | Verify agent registration - name: Linux | Verify agent registration
shell: echo {{ agent_auth_output }} | grep "Valid key created" shell: echo {{ agent_auth_output }} | grep "Valid key received"
when: 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 - wazuh_agent_authd.registration_address is not none
when: when:
- wazuh_agent_authd.enable - wazuh_agent_authd.enable | bool
- not wazuh_agent_config.enrollment.enabled | length > 0 or wazuh_agent_config.enrollment.enabled == 'no' - wazuh_agent_config.enrollment.enabled != 'yes'
tags: tags:
- config - config
- authd - authd