mirror of
https://github.com/wazuh/wazuh-ansible.git
synced 2025-12-10 00:38:17 -06:00
Merge pull request #1831 from wazuh/enhancement/2704-Roles_and_playbooks_backport_Dashboard
Dashboard role backport and adaptation
This commit is contained in:
commit
f809cdef16
@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file.
|
|||||||
|
|
||||||
### Changed
|
### 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))
|
- 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))
|
- 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))
|
- Ansible base configuration files and directories backport ([#1819](https://github.com/wazuh/wazuh-ansible/pull/1819))
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
dashboard_node_name: "dashboard"
|
dashboard_node_name: "dashboard"
|
||||||
wazuh_server_api_host: "localhost"
|
wazuh_server_master_address: "{{ hostvars[inventory_hostname].private_ip }}"
|
||||||
indexer_cluster_nodes:
|
indexer_cluster_nodes:
|
||||||
- "{{ hostvars[inventory_hostname].private_ip }}"
|
- "{{ hostvars[inventory_hostname].private_ip }}"
|
||||||
|
|
||||||
|
|||||||
@ -39,31 +39,19 @@
|
|||||||
- name: Dashboard-config | Remove current opensearch.hosts configuration
|
- name: Dashboard-config | Remove current opensearch.hosts configuration
|
||||||
ansible.builtin.replace:
|
ansible.builtin.replace:
|
||||||
path: /etc/wazuh-dashboard/opensearch_dashboards.yml
|
path: /etc/wazuh-dashboard/opensearch_dashboards.yml
|
||||||
regexp: 'opensearch\.hosts: .*$'
|
regexp: '^opensearch\.hosts:.*(?:\n\s+-\s+https?://[^\n]+)*'
|
||||||
replace: 'opensearch.hosts:'
|
replace: 'opensearch.hosts:'
|
||||||
|
|
||||||
- name: Dashboard-config | Add opensearch.hosts configuration
|
- name: Dashboard-config | Add opensearch.hosts configuration
|
||||||
ansible.builtin.blockinfile:
|
ansible.builtin.replace:
|
||||||
path: /etc/wazuh-dashboard/opensearch_dashboards.yml
|
path: /etc/wazuh-dashboard/opensearch_dashboards.yml
|
||||||
insertafter: 'opensearch.hosts:'
|
regexp: '^opensearch\.hosts:\s*$'
|
||||||
marker: "# OpenSearch hosts configuration"
|
replace: |
|
||||||
block: |
|
opensearch.hosts:
|
||||||
{% for node in indexer_cluster_nodes %}
|
{% for node in indexer_cluster_nodes %}
|
||||||
- https://{{ node }}:9200
|
- https://{{ node }}:9200
|
||||||
{% endfor %}
|
{% 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
|
- name: Copy the certificates from local to the Wazuh dashboard instance
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
src: "{{ local_configs_path }}/wazuh-certificates/{{ item }}"
|
src: "{{ local_configs_path }}/wazuh-certificates/{{ item }}"
|
||||||
@ -89,11 +77,11 @@
|
|||||||
- { src: "{{ dashboard_node_name }}-key.pem", dest: "dashboard-key.pem" }
|
- { src: "{{ dashboard_node_name }}-key.pem", dest: "dashboard-key.pem" }
|
||||||
when: dashboard_node_name != "dashboard"
|
when: dashboard_node_name != "dashboard"
|
||||||
|
|
||||||
- name: Ensure Wazuh dashboard started and enabled
|
- name: Ensure Wazuh dashboard started
|
||||||
ansible.builtin.service:
|
ansible.builtin.service:
|
||||||
name: wazuh-dashboard
|
name: wazuh-dashboard
|
||||||
enabled: true
|
enabled: true
|
||||||
state: started
|
state: restarted
|
||||||
|
|
||||||
- name: Extract server host from dashboard configuration
|
- name: Extract server host from dashboard configuration
|
||||||
ansible.builtin.shell:
|
ansible.builtin.shell:
|
||||||
|
|||||||
@ -79,7 +79,7 @@
|
|||||||
become: true
|
become: true
|
||||||
vars:
|
vars:
|
||||||
dashboard_node_name: "node-6"
|
dashboard_node_name: "node-6"
|
||||||
wazuh_server_api_host: "{{ hostvars.balancer.private_ip }}"
|
wazuh_server_master_address: "{{ hostvars.manager.private_ip }}"
|
||||||
indexer_cluster_nodes:
|
indexer_cluster_nodes:
|
||||||
- "{{ hostvars.wi1.private_ip }}"
|
- "{{ hostvars.wi1.private_ip }}"
|
||||||
- "{{ hostvars.wi2.private_ip }}"
|
- "{{ hostvars.wi2.private_ip }}"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user