roles/agent: add task for determining which wazuh_managers to use through register: yes instead of just grabbing the first one on the list, otherwise fallback to first in the list
This commit is contained in:
parent
1dfe0fdb67
commit
332ee7ae8b
@ -92,6 +92,7 @@ wazuh_managers:
|
||||
api_user: wazuh
|
||||
max_retries: 5
|
||||
retry_interval: 5
|
||||
register: yes
|
||||
|
||||
## Enrollment
|
||||
wazuh_agent_enrollment:
|
||||
|
||||
@ -116,6 +116,13 @@
|
||||
- name: Linux | Agent registration via rest-API
|
||||
block:
|
||||
|
||||
- name: Establish target Wazuh Manager for registration task
|
||||
set_fact:
|
||||
target_manager: '{{ manager_primary | length | ternary(manager_primary, manager_fallback) | first }}'
|
||||
vars:
|
||||
manager_primary: "{{ wazuh_managers | selectattr('register','true') | list }}"
|
||||
manager_fallback: "{{ wazuh_managers | list }}"
|
||||
|
||||
- name: Linux | Create the agent key via rest-API
|
||||
uri:
|
||||
url: "{{ wazuh_managers.0.api_proto }}://{{ wazuh_agent_authd.registration_address }}:{{ wazuh_managers.0.api_port }}/agents/"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user