Skip to content

Commit

Permalink
Merge pull request #579 from splunk/develop
Browse files Browse the repository at this point in the history
Release/8.1.0.1 + 7.3.8
  • Loading branch information
alishamayor authored Nov 23, 2020
2 parents dd53179 + a2f5727 commit 438453b
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 2 deletions.
19 changes: 19 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Navigation

* [8.1.0.1](#8101)
* [8.1.0](#810)
* [8.0.7](#807)
* [8.0.6](#806)
Expand All @@ -14,6 +15,7 @@
* [8.0.2](#802)
* [8.0.1](#801)
* [8.0.0](#800)
* [7.3.8](#738)
* [7.3.7](#737)
* [7.3.6](#736)
* [7.3.5](#735)
Expand All @@ -39,6 +41,13 @@

---

## 8.1.0.1

#### Changes
* Bugfixes and cleanup

---

## 8.1.0

#### What's New?
Expand Down Expand Up @@ -220,6 +229,16 @@ Syncing with latest codebase - currently up to sync with 8.0.6.

---

## 7.3.8

#### What's New?
Syncing with latest codebase - currently up to sync with 8.1.0.1.

#### Changes
* See [8.1.0.1](#8101) changes.

---

## 7.3.7

#### What's New?
Expand Down
2 changes: 1 addition & 1 deletion roles/splunk_common/handlers/restart_splunk.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
- name: "Restart the splunkd service - Via CLI"
command: "{{ splunk.exec }} restart -f --answer-yes --accept-license"
command: "{{ splunk.exec }} restart --answer-yes --accept-license"
become: yes
become_user: "{{ splunk.user }}"
register: task_result
Expand Down
2 changes: 1 addition & 1 deletion roles/splunk_common/tasks/get_facts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
set_fact:
splunk_current_version: "{{ manifests.files[0].path | regex_search(regexp, '\\1') if (manifests.matched == 1) else '0' }}"
splunk_current_build_hash: "{{ manifests.files[0].path | regex_search(regexp, '\\3') if (manifests.matched == 1) else '0' }}"
splunk_target_build_hash: "{{ splunk.build_location | regex_search(regexp, '\\3') | default('0') }}"
splunk_target_build_hash: "{{ splunk.build_location | string | regex_search(regexp, '\\3') | default('0') }}"
vars:
regexp: 'splunk\D*?-(\d+\.\d+\.\d+(\.\d+)?)-(.*?)-.*?'

Expand Down
52 changes: 52 additions & 0 deletions roles/splunk_monitor/tasks/adding_peers.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,60 @@
---
- name: Fetch distsearch server info
uri:
url: "{{ cert_prefix }}://127.0.0.1:{{ splunk.svc_port }}/servicesNS/nobody/search/configs/conf-distsearch/distributedSearch?output_mode=json"
method: GET
user: "{{ splunk.admin_user }}"
password: "{{ splunk.password }}"
validate_certs: false
status_code: 200
return_content: yes
body_format: json
use_proxy: no
register: distsearch_server_info

- name: Initialize lists
set_fact:
current_group_list: []
remove_peer_list: []
updated_group_list: []

- name: Create list of current peers
set_fact:
current_group_list: "{{ current_group_list }} + [ '{{ item }}' ]"
with_items: "{{ distsearch_server_info['json']['entry'][0]['content']['servers'].split(',') }}"
when: distsearch_server_info['json']['entry'][0]['content']['servers'] is defined and (distsearch_server_info['json']['entry'][0]['content']['servers']| length > 0)

- name: Create list of peers
set_fact:
group_list: "{{ groups['splunk_indexer'] | default([]) }} + {{ groups['splunk_search_head'] | default([]) }} + {{ groups['splunk_search_head_captain'] | default([]) }} + {{ groups['splunk_cluster_master'] | default([]) }} + {{ groups['splunk_deployment_server']| default([]) }} + {{ groups['splunk_license_master'] | default([]) }} + {{ groups['splunk_standalone'] | default([]) }}"

- name: Update group_list
set_fact:
updated_group_list: "{{ updated_group_list }} + [ '{{ cert_prefix }}://{{ item }}:{{ splunk.svc_port }}' ]"
with_items: "{{ group_list }}"

- name: Non-existent peers list
set_fact:
remove_peer_list: "{{ remove_peer_list }} + [ '{{ item }}' ]"
with_items: "{{ current_group_list }}"
when: item not in updated_group_list and current_group_list is defined and (current_group_list| length > 0)

- name: Remove search peers
command: "{{ splunk.exec }} remove search-server {{ item }} -auth {{ splunk.admin_user }}:{{ splunk.password }} -remoteUsername {{ splunk.admin_user }} -remotePassword {{ splunk.password }}"
become: yes
become_user: "{{ splunk.user }}"
register: remove_as_peer
until: remove_as_peer.rc == 0 or 'already exists' in remove_as_peer.stderr
retries: "{{ retry_num }}"
delay: "{{ retry_delay }}"
changed_when: remove_as_peer.rc == 0
failed_when: remove_as_peer.rc != 0 and 'already exists' not in remove_as_peer.stderr
notify:
- Restart the splunkd service
no_log: "{{ hide_password }}"
with_items: "{{ remove_peer_list }}"
when: remove_peer_list is defined and (remove_peer_list| length > 0)

- include_tasks: ../../../roles/splunk_common/tasks/wait_for_splunk_instance.yml
vars:
splunk_instance_address: "{{ item }}"
Expand Down
35 changes: 35 additions & 0 deletions roles/splunk_monitor/tasks/post_calls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
validate_certs: false
status_code: 201,409
use_proxy: no
register: distributed_groups
loop:
- "{{ dmc_group_cluster_master }}"
- "{{ dmc_group_indexer }}"
Expand All @@ -28,6 +29,26 @@
- "{{ dmc_group_search_head }}"
- "{{ dmc_group_shc_deployer }}"

- name: Edit DMC Group Requests
uri:
url: "{{ cert_prefix }}://127.0.0.1:{{ splunk.svc_port }}/services/search/distributed/groups/{{ item }}/edit"
method: POST
user: "{{ splunk.admin_user }}"
password: "{{ splunk.password }}"
body: "{{ item }}"
validate_certs: false
status_code: 201,409
use_proxy: no
loop:
- "{{ dmc_group_cluster_master }}"
- "{{ dmc_group_indexer }}"
- "{{ dmc_group_deployment_server }}"
- "{{ dmc_group_kv_store }}"
- "{{ dmc_group_license_master }}"
- "{{ dmc_group_search_head }}"
- "{{ dmc_group_shc_deployer }}"
when: distributed_groups.results[0].status == 409

- name: Cluster Label POST Requests
uri:
url: "{{ cert_prefix }}://127.0.0.1:{{ splunk.svc_port }}/services/search/distributed/groups"
Expand All @@ -39,4 +60,18 @@
status_code: 201,409
use_proxy: no
loop: "{{ cluster_label_list_of_dicts }}"
register: cluster_label
when: cluster_label_list_of_dicts is defined and item.cluster_label | length > 0

- name: Edit Cluster Label POST Requests
uri:
url: "{{ cert_prefix }}://127.0.0.1:{{ splunk.svc_port }}/services/search/distributed/groups"
method: POST
user: "{{ splunk.admin_user }}"
password: "{{ splunk.password }}"
body: "member={{ item.name }}&default=false&name=dmc_indexerclustergroup_{{ item.cluster_label }}/edit"
validate_certs: false
status_code: 201,409
use_proxy: no
loop: "{{ cluster_label_list_of_dicts }}"
when: cluster_label_list_of_dicts is defined and item.cluster_label | length > 0 and cluster_label.results[0].status == 409

0 comments on commit 438453b

Please sign in to comment.