Merge pull request #1831 from wazuh/enhancement/2704-Roles_and_playbooks_backport_Dashboard

Dashboard role backport and adaptation
This commit is contained in:
Gonzalo Acuña 2025-10-31 12:33:25 -03:00 committed by GitHub
commit f809cdef16
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 21 deletions

View File

@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file.
### Changed
- Dashboard role backport and adaptation ([#1831](https://github.com/wazuh/wazuh-ansible/pull/1831))
- Server role backport and adaptation ([#1825](https://github.com/wazuh/wazuh-ansible/pull/1825))
- Indexer role backport and adaptation ([#1823](https://github.com/wazuh/wazuh-ansible/pull/1823))
- Ansible base configuration files and directories backport ([#1819](https://github.com/wazuh/wazuh-ansible/pull/1819))

View File

@ -1,7 +1,7 @@
---
dashboard_node_name: "dashboard"
wazuh_server_api_host: "localhost"
wazuh_server_master_address: "{{ hostvars[inventory_hostname].private_ip }}"
indexer_cluster_nodes:
- "{{ hostvars[inventory_hostname].private_ip }}"

View File

@ -39,31 +39,19 @@
- name: Dashboard-config | Remove current opensearch.hosts configuration
ansible.builtin.replace:
path: /etc/wazuh-dashboard/opensearch_dashboards.yml
regexp: 'opensearch\.hosts: .*$'
regexp: '^opensearch\.hosts:.*(?:\n\s+-\s+https?://[^\n]+)*'
replace: 'opensearch.hosts:'
- name: Dashboard-config | Add opensearch.hosts configuration
ansible.builtin.blockinfile:
ansible.builtin.replace:
path: /etc/wazuh-dashboard/opensearch_dashboards.yml
insertafter: 'opensearch.hosts:'
marker: "# OpenSearch hosts configuration"
block: |
regexp: '^opensearch\.hosts:\s*$'
replace: |
opensearch.hosts:
{% for node in indexer_cluster_nodes %}
- https://{{ node }}:9200
{% endfor %}
- name: Dashboard-config | Remove comments from configuration file
ansible.builtin.replace:
path: "/etc/wazuh-dashboard/opensearch_dashboards.yml"
regexp: '^\s*#.*$'
replace: ''
- name: Dashboard-config | Remove empty lines from config.yml file
ansible.builtin.replace:
path: "/etc/wazuh-dashboard/opensearch_dashboards.yml"
regexp: '^\s*$'
replace: ''
- name: Copy the certificates from local to the Wazuh dashboard instance
ansible.builtin.copy:
src: "{{ local_configs_path }}/wazuh-certificates/{{ item }}"
@ -89,11 +77,11 @@
- { src: "{{ dashboard_node_name }}-key.pem", dest: "dashboard-key.pem" }
when: dashboard_node_name != "dashboard"
- name: Ensure Wazuh dashboard started and enabled
- name: Ensure Wazuh dashboard started
ansible.builtin.service:
name: wazuh-dashboard
enabled: true
state: started
state: restarted
- name: Extract server host from dashboard configuration
ansible.builtin.shell:

View File

@ -79,7 +79,7 @@
become: true
vars:
dashboard_node_name: "node-6"
wazuh_server_api_host: "{{ hostvars.balancer.private_ip }}"
wazuh_server_master_address: "{{ hostvars.manager.private_ip }}"
indexer_cluster_nodes:
- "{{ hostvars.wi1.private_ip }}"
- "{{ hostvars.wi2.private_ip }}"