Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for creating multi indexer cluster #840

Draft
wants to merge 5 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 31 additions & 12 deletions roles/splunk_monitor/tasks/setup_multisite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,16 @@
vars:
splunk_instance_address: "{{ splunk.multisite_master }}"

- name: Convert Extrenal Cluster Master Name into Internal URI
set_fact:
multisite_master_uri: "{{ cert_prefix }}://{{ splunk.multisite_master }}:{{ splunk.svc_port }}"
#INFRA-38882: Update
- name: Setup SH - Multisite
command: "{{ splunk.exec }} edit cluster-config -mode searchhead -master_uri {{ multisite_master_uri }} -auth {{ splunk.admin_user }}:{{ splunk.password }} -secret {{ splunk.idxc.pass4SymmKey }}"
- name: Setup SHC - Multisite for first cluster
command: "{{ splunk.exec }} edit cluster-config -mode searchhead -master_uri {{ cert_prefix }}://{{ splunk.cluster_master_url }}:{{ splunk.svc_port }} -auth {{ splunk.admin_user }}:{{ splunk.password }} -secret {{ splunk.idxc.pass4SymmKey }}"
become: yes
become_user: "{{ splunk.user }}"
register: set_new_master
until: set_new_master.rc == 0 or (set_new_master.rc != 0 and "Cannot edit this searchhead. Use 'splunk edit cluster-master' to edit information for this searchhead." in set_new_master.stderr) or (set_new_master.rc != 0 and "Cannot edit this searchhead. Use 'splunk edit cluster-manager' to edit information for this searchhead." in set_new_master.stderr)
failed_when: (set_new_master.rc != 0 and "Cannot edit this searchhead. Use 'splunk edit cluster-master' to edit information for this searchhead." not in set_new_master.stderr) or (set_new_master.rc != 0 and "Cannot edit this searchhead. Use 'splunk edit cluster-manager' to edit information for this searchhead." not in set_new_master.stderr)
failed_when: set_new_master.rc != 0 and ("Cannot edit this searchhead. Use 'splunk edit cluster-master' to edit information for this searchhead." not in set_new_master.stderr and "Cannot edit this searchhead. Use 'splunk edit cluster-manager' to edit information for this searchhead." not in set_new_master.stderr)
changed_when: set_new_master.rc == 0
retries: "{{ retry_num }}"
delay: "{{ retry_delay }}"
ignore_errors: yes
notify:
- Restart the splunkd service
no_log: "{{ hide_password }}"
Expand All @@ -27,17 +22,41 @@

- include_tasks: ../../../roles/splunk_common/tasks/wait_for_splunk_process.yml

- name: Setup SH with Associated Site
command: "{{ splunk.exec }} edit cluster-master -old_master_uri {{ multisite_master_uri }} -site {{ splunk.site }} -auth {{ splunk.admin_user }}:{{ splunk.password }} -secret {{ splunk.idxc.pass4SymmKey }} -multisite True"
- name: Setup SHC with Associated Site
command: "{{ splunk.exec }} edit cluster-master -old_master_uri {{ cert_prefix }}://{{ splunk.cluster_master_url }}:{{ splunk.svc_port }} -site {{ splunk.site }} -auth {{ splunk.admin_user }}:{{ splunk.password }} -secret {{ splunk.idxc.pass4SymmKey }} -multisite True"
become: yes
become_user: "{{ splunk.user }}"
register: set_associated_site
until: set_associated_site.rc == 0 or (set_associated_site.rc == 22 and 'No change in master or secret or site.' in set_associated_site.stderr) or (set_associated_site.rc == 22 and 'No change in manager or secret or site.' in set_associated_site.stderr)
changed_when: set_associated_site.rc == 0
retries: "{{ retry_num }}"
delay: "{{ retry_delay }}"
ignore_errors: yes
notify:
- Restart the splunkd service
no_log: "{{ hide_password }}"
failed_when: (set_associated_site.rc != 0 and 'No change in master or secret or site.' not in set_associated_site.stderr) or (set_associated_site.rc != 0 and 'No change in manager or secret or site.' not in set_associated_site.stderr)
failed_when: set_associated_site.rc != 0 and ('No change in master or secret or site.' not in set_associated_site.stderr and 'No change in manager or secret or site.' not in set_associated_site.stderr)

- name: Flush restart handlers
meta: flush_handlers

- include_tasks: ../../../roles/splunk_common/tasks/wait_for_splunk_process.yml

- name: Add additional indexer clusters to SH - Multisite
command: "{{ splunk.exec }} add cluster-manager {{ cert_prefix }}://{{ item }}:{{ splunk.svc_port }} -auth {{ splunk.admin_user }}:{{ splunk.password }} -secret {{ splunk.idxc.pass4SymmKey }} -site {{ splunk.site }}"
with_items: "{{ splunk.multisite_master.split(',') }}"
become: yes
become_user: "{{ splunk.user }}"
register: set_new_master
until: set_new_master.rc == 0 or (set_new_master.rc != 0 and "Cannot re-add this manager. It already exists in the conf." in set_new_master.stderr)
failed_when: set_new_master.rc != 0 and ("Cannot re-add this manager. It already exists in the conf." not in set_new_master.stderr )
changed_when: set_new_master.rc == 0
retries: "{{ retry_num }}"
delay: "{{ retry_delay }}"
notify:
- Restart the splunkd service
no_log: "{{ hide_password }}"

- name: Flush restart handlers
meta: flush_handlers

- include_tasks: ../../../roles/splunk_common/tasks/wait_for_splunk_process.yml
40 changes: 29 additions & 11 deletions roles/splunk_search_head/tasks/setup_multisite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,9 @@
- include_tasks: ../../../roles/splunk_common/tasks/wait_for_splunk_instance.yml
vars:
splunk_instance_address: "{{ splunk.multisite_master }}"

#INFRA-38882: Update exec command?
- name: Convert Extrenal Cluster Master Name into Internal URI
set_fact:
multisite_master_uri: "{{ cert_prefix }}://{{ splunk.multisite_master }}:{{ splunk.svc_port }}"

- name: Setup SHC - Multisite
command: "{{ splunk.exec }} edit cluster-config -mode searchhead -master_uri {{ multisite_master_uri }} -auth {{ splunk.admin_user }}:{{ splunk.password }} -secret {{ splunk.idxc.pass4SymmKey }}"

- name: Setup SHC - Multisite for first cluster
command: "{{ splunk.exec }} edit cluster-config -mode searchhead -master_uri {{ cert_prefix }}://{{ splunk.cluster_master_url }}:{{ splunk.svc_port }} -auth {{ splunk.admin_user }}:{{ splunk.password }} -secret {{ splunk.idxc.pass4SymmKey }}"
become: yes
become_user: "{{ splunk.user }}"
register: set_new_master
Expand All @@ -18,7 +13,6 @@
changed_when: set_new_master.rc == 0
retries: "{{ retry_num }}"
delay: "{{ retry_delay }}"
ignore_errors: yes
notify:
- Restart the splunkd service
no_log: "{{ hide_password }}"
Expand All @@ -29,16 +23,40 @@
- include_tasks: ../../../roles/splunk_common/tasks/wait_for_splunk_process.yml

- name: Setup SHC with Associated Site
command: "{{ splunk.exec }} edit cluster-master -old_master_uri {{ multisite_master_uri }} -site {{ splunk.site }} -auth {{ splunk.admin_user }}:{{ splunk.password }} -secret {{ splunk.idxc.pass4SymmKey }} -multisite True"
command: "{{ splunk.exec }} edit cluster-master -old_master_uri {{ cert_prefix }}://{{ splunk.cluster_master_url }}:{{ splunk.svc_port }} -site {{ splunk.site }} -auth {{ splunk.admin_user }}:{{ splunk.password }} -secret {{ splunk.idxc.pass4SymmKey }} -multisite True"
become: yes
become_user: "{{ splunk.user }}"
register: set_associated_site
until: set_associated_site.rc == 0 or (set_associated_site.rc == 22 and 'No change in master or secret or site.' in set_associated_site.stderr) or (set_associated_site.rc == 22 and 'No change in manager or secret or site.' in set_associated_site.stderr)
changed_when: set_associated_site.rc == 0
retries: "{{ retry_num }}"
delay: "{{ retry_delay }}"
ignore_errors: yes
notify:
- Restart the splunkd service
no_log: "{{ hide_password }}"
failed_when: set_associated_site.rc != 0 and ('No change in master or secret or site.' not in set_associated_site.stderr and 'No change in manager or secret or site.' not in set_associated_site.stderr)

- name: Flush restart handlers
meta: flush_handlers

- include_tasks: ../../../roles/splunk_common/tasks/wait_for_splunk_process.yml

- name: Add additional indexer clusters to SH - Multisite
command: "{{ splunk.exec }} add cluster-manager {{ cert_prefix }}://{{ item }}:{{ splunk.svc_port }} -auth {{ splunk.admin_user }}:{{ splunk.password }} -secret {{ splunk.idxc.pass4SymmKey }} -site {{ splunk.site }}"
with_items: "{{ splunk.multisite_master.split(',') }}"
become: yes
become_user: "{{ splunk.user }}"
register: set_new_master
until: set_new_master.rc == 0 or (set_new_master.rc != 0 and "Cannot re-add this manager. It already exists in the conf." in set_new_master.stderr)
failed_when: set_new_master.rc != 0 and ("Cannot re-add this manager. It already exists in the conf." not in set_new_master.stderr )
changed_when: set_new_master.rc == 0
retries: "{{ retry_num }}"
delay: "{{ retry_delay }}"
notify:
- Restart the splunkd service
no_log: "{{ hide_password }}"

- name: Flush restart handlers
meta: flush_handlers

- include_tasks: ../../../roles/splunk_common/tasks/wait_for_splunk_process.yml