wazuh-ansible-4.8.1/roles/opensearch/wazuh-dashboard/tasks/main.yml
2022-02-02 17:27:05 -03:00

124 lines
3.3 KiB
YAML
Executable File

---
- name: Stopping early, trying to compile Wazuh Dashboard Plugin on Debian 10 is not possible
fail:
msg: "It's not possible to compile the Wazuh Dashboard plugin on Debian 10 due to: https://github.com/wazuh/wazuh-kibana-app/issues/1924"
when:
- build_from_sources
- ansible_distribution == "Debian"
- ansible_distribution_major_version == "10"
- import_tasks: RedHat.yml
when: ansible_os_family == 'RedHat'
- import_tasks: Debian.yml
when: ansible_os_family == 'Debian'
- name: Remove Dashboard configuration file
file:
# noqa 503
path: "{{ dashboard_conf_path }}/dashboard.yml"
state: absent
tags: install
- import_tasks: security_actions.yml
- name: Copy Configuration File
template:
src: "templates/dashboard.yml.j2"
dest: "{{ dashboard_conf_path }}/dashboard.yml"
group: wazuh-dashboard
owner: wazuh-dashboard
mode: 0640
force: yes
notify: restart wazuh-dashboard
tags:
- install
- configure
- name: Ensuring Wazuh-Dashboard directory owner
file:
# noqa 208
path: "/usr/share/wazuh-dashboard"
state: directory
owner: wazuh-dashboard
group: wazuh-dashboard
recurse: yes
#- name: Build and Install Wazuh Kibana Plugin from sources
# import_tasks: build_wazuh_plugin.yml
# when:
# - build_from_sources is defined
# - build_from_sources
#- name: Install Wazuh Plugin (can take a while)
# shell: >-
# NODE_OPTIONS="{{ node_options }}" /usr/share/kibana/bin/kibana-plugin install
# {{ wazuh_app_url }}-{{ wazuh_version }}_{{ elastic_stack_version }}-1.zip
# args:
# executable: /bin/bash
# creates: /usr/share/kibana/plugins/wazuh/package.json
# chdir: /usr/share/kibana
# become: yes
# become_user: kibana
# notify: restart kibana
# tags:
# - install
# - skip_ansible_lint
# when:
# - not build_from_sources
#- name: Kibana optimization (can take a while)
# shell: /usr/share/kibana/node/bin/node {{ node_options }} /usr/share/kibana/src/cli/cli.js --optimize -c {{ dashboard_conf_path }}/kibana.yml
# args:
# executable: /bin/bash
# become: yes
# become_user: kibana
# changed_when: false
# tags:
# - skip_ansible_lint
- name: Wait for Wazuh-Indexer port
wait_for: host={{ indexer_network_host }} port={{ indexer_http_port }}
- name: Select correct API protocol
set_fact:
indexer_api_protocol: "{% if dashboard_security is defined and dashboard_security %}https{% else %}http{% endif %}"
- name: Attempting to delete legacy Wazuh index if exists
uri:
url: "{{ indexer_api_protocol }}://{{ indexer_network_host }}:{{ indexer_http_port }}/.wazuh"
method: DELETE
user: "admin"
password: "{{ indexer_admin_password }}"
validate_certs: no
status_code: 200, 404
- name: Create Wazuh Plugin config directory
file:
path: /usr/share/wazuh-dashboard/data/wazuh/config/
state: directory
recurse: yes
owner: wazuh-dashboard
group: wazuh-dashboard
mode: 0751
changed_when: False
- name: Configure Wazuh Dashboard Plugin
template:
src: wazuh.yml.j2
dest: /usr/share/wazuh-dashboard/data/wazuh/config/wazuh.yml
owner: wazuh-dashboard
group: wazuh-dashboard
mode: 0751
changed_when: False
- name: Ensure Wazuh-Dashboard started and enabled
service:
name: wazuh-dashboard
enabled: true
state: started
- import_tasks: RMRedHat.yml
when: ansible_os_family == 'RedHat'