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 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
11 changes: 3 additions & 8 deletions roles/splunk/tasks/configure_idxc_manager.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@
- name: Run splunk version command to check currently installed version
include_tasks: check_splunk_version.yml

# Splunk version < 8.1 supports mode=master
# 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
set_fact:
mode_value: "{% if splunk_version_release | float < 8.1 %}master{% else %}manager{% endif %}"
- name: Set IDXC Values
include_tasks: set_idxc_facts.yml

- name: Configure clustering stanza for cluster manager node
ini_file:
Expand All @@ -25,7 +20,7 @@
- wait for splunkd
no_log: true
loop:
- { option: "mode", value: "{{ mode_value}}" }
- { option: "mode", value: "{{ manager_mode_value }}" }
- { option: "replication_factor", value: "{{ splunk_idxc_rf }}" }
- { option: "search_factor", value: "{{ splunk_idxc_sf }}" }
- { option: "pass4SymmKey", value: "{{ splunk_idxc_key }}" }
Expand Down
11 changes: 3 additions & 8 deletions roles/splunk/tasks/configure_idxc_member.yml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,11 @@
- name: Run splunk version command to check currently installed version
include_tasks: check_splunk_version.yml

# Splunk version >= 8.1 supports mode=peer
# 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
set_fact:
mode_value: "{% if splunk_version_release | float < 8.1 %}slave{% else %}peer{% endif %}"
- name: Set IDXC Values
include_tasks: set_idxc_facts.yml

- 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 {{ peer_mode_value }} -auth {{ splunk_auth }} -{{ manager_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
8 changes: 7 additions & 1 deletion roles/splunk/tasks/configure_idxc_sh.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
---
- name: Run splunk version command to check currently installed version
include_tasks: check_splunk_version.yml

- name: Set IDXC Values
include_tasks: set_idxc_facts.yml

- 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 -{{ manager_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
12 changes: 12 additions & 0 deletions roles/splunk/tasks/set_idxc_facts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
# Splunk version < 8.1 supports mode=master
# 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 and value based on Splunk version
set_fact:
manager_mode_value: "{% if splunk_version_release | version('8.1', '<') %}master{% else %}manager{% endif %}"
peer_mode_value: "{% if splunk_version_release | version('8.1', '<') %}slave{% else %}peer{% endif %}"
manager_uri_value: "{% if splunk_version_release | version('8.1', '<') %}master_uri{% else %}manager_uri{% endif %}"
when: splunk_version_release is version('8.1', '>=')