Check if the Wazuh template exits
This commit is contained in:
parent
cfbbf49855
commit
6fde2836c7
@ -37,6 +37,14 @@
|
|||||||
- configure
|
- configure
|
||||||
- init
|
- init
|
||||||
|
|
||||||
|
- name: Check for Wazuh template
|
||||||
|
uri:
|
||||||
|
url: "http://{{elasticsearch_network_host}}:{{elasticsearch_http_port}}/_template/wazuh"
|
||||||
|
method: GET
|
||||||
|
status_code: 200, 404
|
||||||
|
register: wazuh_template_exits
|
||||||
|
tags: init
|
||||||
|
|
||||||
- name: Installing Wazuh template
|
- name: Installing Wazuh template
|
||||||
uri:
|
uri:
|
||||||
url: "http://{{elasticsearch_network_host}}:{{elasticsearch_http_port}}/_template/wazuh"
|
url: "http://{{elasticsearch_network_host}}:{{elasticsearch_http_port}}/_template/wazuh"
|
||||||
@ -44,13 +52,14 @@
|
|||||||
status_code: 200
|
status_code: 200
|
||||||
body_format: json
|
body_format: json
|
||||||
body: "{{ lookup('template','wazuh-elastic5-template.json.j2') }}"
|
body: "{{ lookup('template','wazuh-elastic5-template.json.j2') }}"
|
||||||
|
when: wazuh_template_exits.status != 200
|
||||||
tags: init
|
tags: init
|
||||||
|
|
||||||
- name: Injecting sample alert
|
- name: Injecting sample alert
|
||||||
uri:
|
uri:
|
||||||
url: "http://{{elasticsearch_network_host}}:{{elasticsearch_http_port}}/wazuh-alerts-{{ ansible_date_time.date | regex_replace('-', '.') }}/wazuh/sample"
|
url: "http://{{elasticsearch_network_host}}:{{elasticsearch_http_port}}/wazuh-alerts-{{ ansible_date_time.date | regex_replace('-', '.') }}/wazuh/sample"
|
||||||
method: PUT
|
method: PUT
|
||||||
status_code: 201
|
status_code: 200, 201
|
||||||
body_format: json
|
body_format: json
|
||||||
body: "{{ lookup('template','alert_sample.json.j2') }}"
|
body: "{{ lookup('template','alert_sample.json.j2') }}"
|
||||||
tags: init
|
tags: init
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user