Skip to content

Commit eef9e8e

Browse files
authored
Merge pull request #10 from merizrizal/integrate-with-opensearch
Integrate with OpenSearch
2 parents 6af1831 + d2fc9be commit eef9e8e

33 files changed

+837
-13
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
ansible_connection: ssh
3+
ansible_ssh_common_args: -o "UserKnownHostsFile=/dev/null" -o StrictHostKeyChecking=no -o "PubkeyAuthentication=no"
4+
5+
os_cluster_name: openstack-cluster
6+
os_download_url: https://artifacts.opensearch.org/releases/bundle/opensearch
7+
os_version: 3.4.0
8+
os_api_port: 9200
9+
os_home: /usr/share/opensearch
10+
os_config_dir: "{{ os_home }}/config"
11+
os_sec_plugin_config_dir: "{{ os_home }}/config/opensearch-security"
12+
13+
xms_value: 2
14+
xmx_value: 2
15+
cluster_type: single-node
16+
auth_type: internal
17+
domain_name: openstacklab.net
18+
cert_valid_days: 730
19+
20+
os_dashboards_version: 3.4.0
21+
os_dashboards_home: /usr/share/opensearch-dashboards
22+
os_dashboards_config_dir: "{{ os_dashboards_home }}/config"
23+
24+
logstash_download_url: https://artifacts.elastic.co/downloads/logstash
25+
logstash_version: 9.2.3
26+
logstash_beat_port: 5044
27+
logstash_home: /usr/share/logstash
28+
29+
filebeat_download_url: https://artifacts.elastic.co/downloads/beats/filebeat
30+
filebeat_version: 9.2.3
31+
filebeat_home: /usr/share/filebeat
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
ansible_user: vagrant
3+
ansible_password: vagrant
4+
ansible_sudo_pass: vagrant
5+
6+
os_sys_user: opensearch
7+
os_sys_dashboards_user: opensearch-dashboards
8+
9+
os_admin_user: admin
10+
os_admin_password: admin12345
11+
12+
os_kibana_user: kibana
13+
os_kibana_password: kibana12345
14+
15+
os_dashboards_admin_user: admin
16+
os_dashboards_admin_password: admin12345
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
lab:
3+
vars:
4+
root_dir: "{{ lookup('ansible.builtin.env', 'ROOT_DIR') }}"
5+
target_env: local
6+
children:
7+
controller:
8+
hosts:
9+
controller01:
10+
ansible_host: "{{ controller01.mgmtnet_ip_address }}"
11+
compute:
12+
hosts:
13+
compute01:
14+
ansible_host: "{{ compute01.mgmtnet_ip_address }}"
15+
compute02:
16+
ansible_host: "{{ compute02.mgmtnet_ip_address }}"
17+
storage:
18+
hosts:
19+
storage01:
20+
ansible_host: "{{ storage01.mgmtnet_ip_address }}"
21+
os_cluster:
22+
hosts:
23+
controller01:
24+
os_master:
25+
hosts:
26+
controller01:
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
- name: Install OpenSearch
3+
ansible.builtin.import_playbook: playbook_setup_opensearch.yml
4+
5+
- name: Install OpenSearch Dashboards
6+
ansible.builtin.import_playbook: playbook_setup_opensearch_dashboard.yml
7+
8+
- name: Install Beats
9+
ansible.builtin.import_playbook: playbook_setup_filebeat.yml
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
- name: Deploy and setup Filebeat
3+
hosts: controller, compute, storage
4+
become: true
5+
vars_files:
6+
- "{{ root_dir ~ '/inventories/' ~ target_env ~ '/nodes.yml' }}"
7+
roles:
8+
- role: filebeat
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
- name: Deploy and setup OpenSearch
3+
hosts: controller
4+
become: true
5+
vars_files:
6+
- "{{ root_dir ~ '/inventories/' ~ target_env ~ '/nodes.yml' }}"
7+
roles:
8+
- role: opensearch
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
- name: Deploy and setup OpenSearch Dashboards
3+
hosts: controller
4+
become: true
5+
vars_files:
6+
- "{{ root_dir ~ '/inventories/' ~ target_env ~ '/nodes.yml' }}"
7+
roles:
8+
- role: dashboards
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
- name: Set open files limit in sysctl.conf
3+
ansible.posix.sysctl:
4+
name: fs.file-max
5+
value: 65536
6+
state: present
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
- name: Download OpenSearch Dashboards archive to localhost
3+
ansible.builtin.get_url:
4+
url: "{{ os_download_url }}-dashboards/{{ os_dashboards_version }}/opensearch-dashboards-{{ os_dashboards_version }}-linux-x64.tar.gz"
5+
dest: /tmp/opensearch-dashboards.tar.gz
6+
mode: "644"
7+
become: false
8+
delegate_to: localhost
9+
run_once: true
10+
11+
- name: Create OpenSearch Dashboards user
12+
ansible.builtin.user:
13+
name: "{{ os_sys_dashboards_user }}"
14+
state: present
15+
shell: /bin/false
16+
create_home: true
17+
home: "{{ os_dashboards_home }}"
18+
19+
- name: Create OpenSearch Dashboards home directory
20+
ansible.builtin.file:
21+
path: "{{ os_dashboards_home }}"
22+
state: directory
23+
owner: "{{ os_sys_dashboards_user }}"
24+
group: "{{ os_sys_dashboards_user }}"
25+
mode: "755"
26+
27+
- name: Upload OpenSearch Dashboards and extract
28+
ansible.builtin.unarchive:
29+
src: /tmp/opensearch-dashboards.tar.gz
30+
dest: "{{ os_dashboards_home }}"
31+
owner: "{{ os_sys_dashboards_user }}"
32+
group: "{{ os_sys_dashboards_user }}"
33+
extra_opts: ["--strip-components=1", "--show-stored-names"]
34+
35+
- name: Copy configuration file
36+
ansible.builtin.template:
37+
src: opensearch_dashboards.yml.j2
38+
dest: "{{ os_dashboards_config_dir }}/opensearch_dashboards.yml"
39+
owner: "{{ os_sys_dashboards_user }}"
40+
group: "{{ os_sys_dashboards_user }}"
41+
mode: "644"
42+
43+
- name: Create OpenSearch Dashboards systemd service
44+
ansible.builtin.template:
45+
src: dashboards.service.j2
46+
dest: /etc/systemd/system/dashboards.service
47+
mode: "644"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
- name: Set facts
3+
ansible.builtin.set_fact:
4+
mgmtnet_ip_address: "{{ node.mgmtnet_ip_address }}"
5+
vars:
6+
node: "{{ lookup('ansible.builtin.vars', ansible_facts['hostname']) }}"
7+
8+
- name: Configure the system settings and stuff
9+
ansible.builtin.include_tasks:
10+
file: configure.yml
11+
12+
- name: Install OpenSearch Dashboards
13+
ansible.builtin.include_tasks:
14+
file: install.yml
15+
16+
- name: Start services
17+
ansible.builtin.systemd_service:
18+
name: dashboards
19+
enabled: true
20+
state: restarted
21+
daemon_reload: true

0 commit comments

Comments
 (0)