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

Changes needed to support both old and new cluster configuration #217

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
11 changes: 9 additions & 2 deletions roles/splunk/tasks/configure_idxc_manager.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,16 @@
# https://docs.splunk.com/Documentation/Splunk/8.0.9/Indexer/Configuremasterwithserverconf
# Splunk version >= 8.1 supports mode=manager
# https://docs.splunk.com/Documentation/Splunk/latest/Indexer/Configuremanagerwithserverconf
- name: Setting clustering mode based on Splunk version number

- name: Setting clustering mode to master base on Splunk version
set_fact:
mode_value: "master"
when: splunk_version_release is version('8.1', '<')

- name: Setting clustering mode to manager base on Splunk version
set_fact:
mode_value: "{% if splunk_version_release | float < 8.1 %}master{% else %}manager{% endif %}"
mode_value: "manager"
dtwersky marked this conversation as resolved.
Show resolved Hide resolved
when: splunk_version_release is version('8.1', '>=')

- name: Configure clustering stanza for cluster manager node
ini_file:
Expand Down
15 changes: 12 additions & 3 deletions roles/splunk/tasks/configure_idxc_member.yml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,21 @@
# https://docs.splunk.com/Documentation/Splunk/latest/Indexer/ConfigurepeerswithCLI
# Splunk version < 8.1 supports mode=slave
# https://docs.splunk.com/Documentation/Splunk/8.0.9/Indexer/ConfigurepeerswithCLI
- name: Setting clustering mode based on Splunk version number

- name: Setting clustering mode to slave and uri to master base on Splunk version
set_fact:
mode_value: "slave"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this:

Suggested change
mode_value: "slave"
mode_value: "{% if splunk_version_release | version('8.1', '<') %}slave{% else %}peer{% endif %}"

These changes (if tested and working) will combine both 8.1 and later into one task

uri_value: "master_uri"
when: splunk_version_release is version('8.1', '<')

- name: Setting clustering mode to peer and uri to manager base on Splunk version
set_fact:
mode_value: "{% if splunk_version_release | float < 8.1 %}slave{% else %}peer{% endif %}"
mode_value: "peer"
uri_value: "manager_uri"
when: splunk_version_release is version('8.1', '>=')

- name: Configure idxc member
command: "{{ splunk_home }}/bin/splunk edit cluster-config -mode {{ mode_value }} -auth {{ splunk_auth }} -master_uri {{ splunk_uri_cm }} -replication_port {{ splunk_idxc_rep_port }} -secret {{ splunk_idxc_key }}"
command: "{{ splunk_home }}/bin/splunk edit cluster-config -mode {{ mode_value }} -auth {{ splunk_auth }} -{{ uri_value }} {{ splunk_uri_cm }} -replication_port {{ splunk_idxc_rep_port }} -secret {{ splunk_idxc_key }}"
become: true
become_user: "{{ splunk_nix_user }}"
register: idxc_peer_init_result
Expand Down
15 changes: 14 additions & 1 deletion roles/splunk/tasks/configure_idxc_sh.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
---
- name: Run splunk version command to check currently installed version
include_tasks: check_splunk_version.yml

- name: Setting clustering mode to slave and uri to master base on Splunk version
set_fact:
uri_value: "master_uri"
when: splunk_version_release is version('8.1', '<')

- name: Setting clustering mode to peer and uri to manager base on Splunk version
set_fact:
uri_value: "manager_uri"
when: splunk_version_release is version('8.1', '>=')

- name: Configure search head to join indexer cluster
command: "{{ splunk_home }}/bin/splunk edit cluster-config -mode searchhead -master_uri {{ splunk_uri_cm }} -secret {{ splunk_idxc_key }} -auth {{ splunk_auth }}"
command: "{{ splunk_home }}/bin/splunk edit cluster-config -mode searchhead -{{ uri_value }} {{ splunk_uri_cm }} -secret {{ splunk_idxc_key }} -auth {{ splunk_auth }}"
become: true
become_user: "{{ splunk_nix_user }}"
register: idxc_sh_join_result
Expand Down