Skip to content
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
12 changes: 6 additions & 6 deletions roles/splunk_search_head/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
set_fact:
splunk_search_head_captain: false

- name: Determine captaincy
- name: Extract subdomain from hostname
set_fact:
splunk_search_head_captain: true
when: ansible_hostname == splunk.search_head_captain_url or
ansible_fqdn == splunk.search_head_captain_url or
splunk.hostname == splunk.search_head_captain_url or
splunk.role == "splunk_search_head_captain"
splunk_hostname_subdomain: "{{ splunk.hostname.split('.')[0] }}"

- name: Splunk FQDN hostname with mesh endpoint
set_fact:
splunk_hostname_mesh: "{{ splunk.hostname | replace('cluster.local','mesh.sfdc.net') }}"

- include_tasks: search_head_clustering.yml
when:
Expand Down
26 changes: 25 additions & 1 deletion roles/splunk_search_head/tasks/search_head_clustering.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,33 @@
- include_tasks: ../../../roles/splunk_common/tasks/wait_for_splunk_instance.yml
vars:
splunk_instance_address: "{{ splunk.deployer_url }}"

- name: Determine captaincy
set_fact:
splunk_search_head_captain: true
when: splunk_hostname_subdomain in splunk.search_head_captain_url

- name: Update Server name in server.conf to use FQDN
ini_file:
dest: "{{ splunk.home }}/etc/system/local/server.conf"
section: general
option: "serverName"
value: "{{ splunk_hostname_mesh }}"
owner: "{{ splunk.user }}"
group: "{{ splunk.group }}"

- name: Set register replication address
ini_file:
dest: "{{ splunk.home }}/etc/system/local/server.conf"
section: shclustering
option: "register_replication_address"
value: "{{ splunk_hostname_mesh }}"
owner: "{{ splunk.user }}"
group: "{{ splunk.group }}"

#INFRA-38882: Update exec command?
- name: Initialize SHC cluster config
command: "{{ splunk.exec }} init shcluster-config -auth '{{ splunk.admin_user }}:{{ splunk.password }}' -mgmt_uri '{{ cert_prefix }}://{{ splunk.hostname }}:{{ splunk.svc_port }}' -replication_port {{ splunk.shc.replication_port }} -replication_factor {{ splunk.shc.replication_factor }} -conf_deploy_fetch_url '{{ cert_prefix }}://{{ splunk.deployer_url }}:{{ splunk.svc_port }}' -secret '{{ splunk.shc.pass4SymmKey }}' -shcluster_label '{{ splunk.shc.label }}'"
command: "{{ splunk.exec }} init shcluster-config -auth '{{ splunk.admin_user }}:{{ splunk.password }}' -mgmt_uri '{{ cert_prefix }}://{{ splunk_hostname_mesh }}:{{ splunk.svc_port }}' -replication_port {{ splunk.shc.replication_port }} -replication_factor {{ splunk.shc.replication_factor }} -conf_deploy_fetch_url '{{ cert_prefix }}://{{ splunk.deployer_url }}:{{ splunk.svc_port }}' -secret '{{ splunk.shc.pass4SymmKey }}' -shcluster_label '{{ splunk.shc.label }}'"
become: yes
become_user: "{{ splunk.user }}"
register: task_result
Expand Down