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

set resource_limits for limits.conf #788

Open
wants to merge 3 commits into
base: develop
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
3 changes: 3 additions & 0 deletions inventory/environ.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ def overrideEnvironmentVars(vars_scope):
vars_scope["splunk"]["root_endpoint"] = os.environ.get('SPLUNK_ROOT_ENDPOINT', vars_scope["splunk"]["root_endpoint"])
vars_scope["splunk"]["svc_port"] = os.environ.get('SPLUNK_SVC_PORT', vars_scope["splunk"]["svc_port"])
vars_scope["splunk"]["splunk_http_enabled"] = os.environ.get('ENABLE_TCP_MODE', vars_scope["splunk"]["enable_tcp_mode"])
vars_scope["splunk"]["resource_limits_source"] = os.environ.get('SPLUNK_RESOURCE_LIMITS_SOURCE', vars_scope["splunk"]["resource_limits_source"])
vars_scope["splunk"]["s2s"]["port"] = int(os.environ.get('SPLUNK_S2S_PORT', vars_scope["splunk"]["s2s"]["port"]))
vars_scope["splunk"]["enable_service"] = os.environ.get('SPLUNK_ENABLE_SERVICE', vars_scope["splunk"]["enable_service"])
vars_scope["splunk"]["service_name"] = os.environ.get('SPLUNK_SERVICE_NAME', vars_scope["splunk"]["service_name"])
Expand All @@ -584,6 +585,8 @@ def overrideEnvironmentVars(vars_scope):

if vars_scope["splunk"]["splunk_http_enabled"] == "false" and "forwarder" not in vars_scope["splunk"]["role"].lower():
vars_scope["splunk"]["splunk_http_enabled"] = "true"
if vars_scope["splunk"]["resource_limits_source"] not in ["hardware", "container_sok"]:
vars_scope["splunk"]["resource_limits_source"] = "hardware"
# Set set_search_peers to False to disable peering to indexers when creating multisite topology
if os.environ.get("SPLUNK_SET_SEARCH_PEERS", "").lower() == "false":
vars_scope["splunk"]["set_search_peers"] = False
Expand Down
1 change: 1 addition & 0 deletions inventory/splunk_defaults_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ splunk:
secret:
pass4SymmKey:
svc_port: 8089
resource_limits_source: "hardware"
ssl:
enable: True
cert:
Expand Down
1 change: 1 addition & 0 deletions inventory/splunk_defaults_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ splunk:
secret:
pass4SymmKey:
svc_port: 8089
resource_limits_source: "hardware"
ssl:
enable: True
cert:
Expand Down
1 change: 1 addition & 0 deletions inventory/splunkforwarder_defaults_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ splunk:
secret:
pass4SymmKey:
svc_port: 8089
resource_limits_source: "hardware"
ssl:
enable: True
cert:
Expand Down
1 change: 1 addition & 0 deletions inventory/splunkforwarder_defaults_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ splunk:
secret:
pass4SymmKey:
svc_port: 8089
resource_limits_source: "hardware"
ssl:
enable: True
cert:
Expand Down
2 changes: 2 additions & 0 deletions roles/splunk_common/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@
- include_tasks: enable_dsp.yml
when: "'dsp' in splunk and 'enable' in splunk.dsp and splunk.dsp.enable"

- include_tasks: set_resource_limits.yml

- include_tasks: start_splunk.yml

- include_tasks: set_certificate_prefix.yml
Expand Down
9 changes: 9 additions & 0 deletions roles/splunk_common/tasks/set_resource_limits.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
- name: Configure Resource Limits as {{ splunk.resource_limits_source }}
ini_file:
dest: "{{ splunk.home }}/etc/system/local/limits.conf"
option: "resource_limits_source"
section: "system_checks"
value: "{{ splunk.resource_limits_source }}"
owner: "{{ splunk.user }}"
group: "{{ splunk.group }}"