From 78ff9920aa794a105c91b39f756a61d603d5af51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Acu=C3=B1a?= Date: Fri, 18 Feb 2022 14:14:23 -0300 Subject: [PATCH] Single node deployment update --- README.md | 64 ++++++++++++------- playbooks/wazuh-opensearch-single.yml | 22 ++++++- .../wazuh-dashboard/defaults/main.yml | 4 +- .../wazuh-dashboard/tasks/Debian.yml | 1 + .../wazuh-dashboard/tasks/RedHat.yml | 1 + .../opensearch/wazuh-dashboard/tasks/main.yml | 2 +- .../wazuh-indexer/tasks/RMRedHat.yml | 1 - 7 files changed, 66 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index db7ac89f..172f8524 100644 --- a/README.md +++ b/README.md @@ -304,35 +304,51 @@ The hereunder example playbook uses the `wazuh-ansible` role to provision a sing ```yaml --- +# Certificates generation + - hosts: aio + roles: + - role: ../roles/opensearch/wazuh-indexer + perform_installation: false + become: no + #become_user: root + vars: + indexer_node_master: true + instances: + node1: + name: node-1 # Important: must be equal to indexer_node_name. + ip: 127.0.0.1 + role: indexer + tags: + - generate-certs # Single node - - hosts: server - become: yes - become_user: root - roles: - - role: ../roles/opendistro/opendistro-elasticsearch - - role: "../roles/wazuh/ansible-wazuh-manager" - - role: "../roles/wazuh/ansible-filebeat-oss" - - role: "../roles/opendistro/opendistro-kibana" - vars: - single_node: true - minimum_master_nodes: 1 - elasticsearch_node_master: true - elasticsearch_network_host: - filebeat_node_name: node-1 - filebeat_output_indexer_hosts: - ansible_ssh_user: vagrant - ansible_ssh_private_key_file: /path/to/ssh/key.pem - ansible_ssh_extra_args: '-o StrictHostKeyChecking=no' - instances: - node1: - name: node-1 # Important: must be equal to elasticsearch_node_name. - ip: + - hosts: aio + become: yes + become_user: root + roles: + - role: ../roles/opensearch/wazuh-indexer + - role: ../roles/wazuh/ansible-wazuh-manager + - role: ../roles/wazuh/ansible-filebeat-oss + - role: ../roles/opensearch/wazuh-dashboard + vars: + single_node: true + minimum_master_nodes: 1 + indexer_node_master: true + indexer_network_host: 127.0.0.1 + filebeat_node_name: node-1 + filebeat_output_indexer_hosts: + - 127.0.0.1 + instances: + node1: + name: node-1 # Important: must be equal to indexer_node_name. + ip: 127.0.0.1 + role: indexer + ansible_shell_allow_world_readable_temp: true ``` ### Inventory file ```ini -[server] +[aio] [all:vars] @@ -344,7 +360,7 @@ ansible_ssh_extra_args='-o StrictHostKeyChecking=no' ### Launching the playbook ```bash -ansible-playbook wazuh-odfe-single.yml -i inventory +sudo ansible-playbook wazuh-opensearch-single.yml -i inventory ``` After the playbook execution, the Wazuh UI should be reachable through `https://:5601` diff --git a/playbooks/wazuh-opensearch-single.yml b/playbooks/wazuh-opensearch-single.yml index c89f4990..10e36107 100644 --- a/playbooks/wazuh-opensearch-single.yml +++ b/playbooks/wazuh-opensearch-single.yml @@ -1,6 +1,22 @@ --- +# Certificates generation + - hosts: aio + roles: + - role: ../roles/opensearch/wazuh-indexer + perform_installation: false + become: no + #become_user: root + vars: + indexer_node_master: true + instances: + node1: + name: node-1 # Important: must be equal to indexer_node_name. + ip: 127.0.0.1 + role: indexer + tags: + - generate-certs # Single node - - hosts: + - hosts: aio become: yes become_user: root roles: @@ -14,9 +30,11 @@ indexer_node_master: true indexer_network_host: 127.0.0.1 filebeat_node_name: node-1 - filebeat_output_indexer_hosts: 127.0.0.1 + filebeat_output_indexer_hosts: + - 127.0.0.1 instances: node1: name: node-1 # Important: must be equal to indexer_node_name. ip: 127.0.0.1 + role: indexer ansible_shell_allow_world_readable_temp: true diff --git a/roles/opensearch/wazuh-dashboard/defaults/main.yml b/roles/opensearch/wazuh-dashboard/defaults/main.yml index 4bf534f0..2f6c46f3 100644 --- a/roles/opensearch/wazuh-dashboard/defaults/main.yml +++ b/roles/opensearch/wazuh-dashboard/defaults/main.yml @@ -9,7 +9,9 @@ dashboard_server_host: "0.0.0.0" dashboard_server_port: "5601" dashboard_server_name: "dashboard" wazuh_version: 4.3.0 - +indexer_cluster_nodes: + - 127.0.0.1 + # The Wazuh dashboard package repository dashboard_version: "4.3.0" diff --git a/roles/opensearch/wazuh-dashboard/tasks/Debian.yml b/roles/opensearch/wazuh-dashboard/tasks/Debian.yml index 5ff2b2be..9cee7937 100644 --- a/roles/opensearch/wazuh-dashboard/tasks/Debian.yml +++ b/roles/opensearch/wazuh-dashboard/tasks/Debian.yml @@ -17,6 +17,7 @@ apt: name: "wazuh-dashboard={{ dashboard_version }}-1" state: present + update_cache: yes register: install tags: diff --git a/roles/opensearch/wazuh-dashboard/tasks/RedHat.yml b/roles/opensearch/wazuh-dashboard/tasks/RedHat.yml index a6db8256..c10fab59 100644 --- a/roles/opensearch/wazuh-dashboard/tasks/RedHat.yml +++ b/roles/opensearch/wazuh-dashboard/tasks/RedHat.yml @@ -14,6 +14,7 @@ package: name: "wazuh-dashboard-{{ dashboard_version }}" state: present + update_cache: yes register: install tags: diff --git a/roles/opensearch/wazuh-dashboard/tasks/main.yml b/roles/opensearch/wazuh-dashboard/tasks/main.yml index 7daf7b1e..f166ef4f 100755 --- a/roles/opensearch/wazuh-dashboard/tasks/main.yml +++ b/roles/opensearch/wazuh-dashboard/tasks/main.yml @@ -72,7 +72,7 @@ mode: 0751 changed_when: False -- name: Configure opensearch.password in opensearch.keystore +- name: Configure opensearch.password in opensearch_dashboards.keystore shell: >- echo {{ dashboard_password }} | /usr/share/wazuh-dashboard/bin/opensearch-dashboards-keystore --allow-root add -f --stdin opensearch.password args: diff --git a/roles/opensearch/wazuh-indexer/tasks/RMRedHat.yml b/roles/opensearch/wazuh-indexer/tasks/RMRedHat.yml index c0c769d3..d76bd148 100644 --- a/roles/opensearch/wazuh-indexer/tasks/RMRedHat.yml +++ b/roles/opensearch/wazuh-indexer/tasks/RMRedHat.yml @@ -1,6 +1,5 @@ --- - name: RedHat/CentOS/Fedora | Remove Wazuh-Indexer repository (and clean up left-over metadata) - ## 732 will not be needed and if it is needed the wazuh repo should be removed. yum_repository: name: wazuh_repo state: absent