Merge pull request #421 from wazuh/feature-126-delegate-registration
Test #127 agent registration
This commit is contained in:
commit
0f338ed638
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
- name: restart elasticsearch
|
- name: restart elasticsearch
|
||||||
service:
|
service:
|
||||||
name: elasticsearch
|
name: elasticsearch
|
||||||
state: restarted
|
state: restarted
|
||||||
|
|||||||
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
- name: RedHat/CentOS/Fedora | Install OpenJDK 11
|
- name: RedHat/CentOS/Fedora | Install OpenJDK 11
|
||||||
yum:
|
yum:
|
||||||
name: java-11-openjdk-devel
|
name: java-11-openjdk-devel
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: RedHat/CentOS/Fedora | Install OpenDistro dependencies
|
- name: RedHat/CentOS/Fedora | Install OpenDistro dependencies
|
||||||
|
|||||||
@ -73,7 +73,6 @@
|
|||||||
path: "{{ filebeat_module_folder }}"
|
path: "{{ filebeat_module_folder }}"
|
||||||
register: filebeat_module_folder
|
register: filebeat_module_folder
|
||||||
|
|
||||||
|
|
||||||
- name: Download Filebeat module package
|
- name: Download Filebeat module package
|
||||||
get_url:
|
get_url:
|
||||||
url: "{{ filebeat_module_package_url }}/{{ filebeat_module_package_name }}"
|
url: "{{ filebeat_module_package_url }}/{{ filebeat_module_package_name }}"
|
||||||
|
|||||||
@ -39,6 +39,7 @@ wazuh_managers:
|
|||||||
api_port: 55000
|
api_port: 55000
|
||||||
api_proto: 'http'
|
api_proto: 'http'
|
||||||
api_user: null
|
api_user: null
|
||||||
|
wazuh_api_reachable_from_agent: false
|
||||||
wazuh_profile_centos: 'centos, centos7, centos7.6'
|
wazuh_profile_centos: 'centos, centos7, centos7.6'
|
||||||
wazuh_profile_ubuntu: 'ubuntu, ubuntu18, ubuntu18.04'
|
wazuh_profile_ubuntu: 'ubuntu, ubuntu18, ubuntu18.04'
|
||||||
wazuh_auto_restart: 'yes'
|
wazuh_auto_restart: 'yes'
|
||||||
|
|||||||
@ -123,15 +123,15 @@
|
|||||||
user: "{{ wazuh_managers.0.api_user }}"
|
user: "{{ wazuh_managers.0.api_user }}"
|
||||||
password: "{{ api_pass }}"
|
password: "{{ api_pass }}"
|
||||||
register: newagent_api
|
register: newagent_api
|
||||||
notify: restart wazuh-agent
|
delegate_to: "{{ 'localhost' if not wazuh_api_reachable_from_agent else inventory_hostname }}"
|
||||||
# changed_when: newagent_api.json.error == 0
|
become: no
|
||||||
vars:
|
changed_when: newagent_api.json.error == 0
|
||||||
agent_name: "{% if single_agent_name is defined %}{{ single_agent_name }}{% else %}{{ inventory_hostname }}{% endif %}"
|
|
||||||
when:
|
when:
|
||||||
- not check_keys.stat.exists or check_keys.stat.size == 0
|
- not check_keys.stat.exists or check_keys.stat.size == 0
|
||||||
- wazuh_agent_authd.registration_address is not none
|
- wazuh_managers.0.address is not none
|
||||||
become: false
|
tags:
|
||||||
ignore_errors: true
|
- config
|
||||||
|
- api
|
||||||
|
|
||||||
- name: Linux | Retieve new agent data via rest-API
|
- name: Linux | Retieve new agent data via rest-API
|
||||||
uri:
|
uri:
|
||||||
@ -148,8 +148,11 @@
|
|||||||
- wazuh_agent_authd.registration_address is not none
|
- wazuh_agent_authd.registration_address is not none
|
||||||
- newagent_api.json.error == 0
|
- newagent_api.json.error == 0
|
||||||
register: newagentdata_api
|
register: newagentdata_api
|
||||||
delegate_to: localhost
|
delegate_to: "{{ 'localhost' if not wazuh_api_reachable_from_agent else inventory_hostname }}"
|
||||||
become: false
|
become: no
|
||||||
|
tags:
|
||||||
|
- config
|
||||||
|
- api
|
||||||
|
|
||||||
- name: Linux | Register agent (via rest-API)
|
- name: Linux | Register agent (via rest-API)
|
||||||
command: /var/ossec/bin/manage_agents
|
command: /var/ossec/bin/manage_agents
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user