Skip to content
Draft
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
8 changes: 8 additions & 0 deletions inventory/environ.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ def getDefaultVars():
getASan(defaultVars)
getDisablePopups(defaultVars)
getHEC(defaultVars)
getContainerEnv(defaultVars)
getSecrets(defaultVars)
getSplunkPaths(defaultVars)
getIndexerClustering(defaultVars)
Expand Down Expand Up @@ -523,6 +524,13 @@ def getHEC(vars_scope):
else:
vars_scope["splunk"]["hec"]["ssl"] = bool(vars_scope["splunk"]["hec"].get("ssl"))

def getContainerEnv(vars_scope):
"""
Get the configured max cpu, vcpu, and system memory
"""
vars_scope["splunk"]["containerEnv"] = os.environ.get("SPLUNK_CONTAINER_ENV", vars_scope["splunk"].get("containerEnv"))
vars_scope["splunk"]["cgroup"] = os.environ.get("SPLUNK_CGROUP_PATH", vars_scope["splunk"].get("cgroup"))

def getDSP(vars_scope):
"""
Configure DSP settings
Expand Down
27 changes: 26 additions & 1 deletion roles/splunk_common/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,29 @@
- include_tasks: add_splunk_license.yml

- include_tasks: disable_popups.yml
when: "'disable_popups' in splunk and splunk.disable_popups | bool"
when: "'disable_popups' in splunk and splunk.disable_popups | bool"

# set containerEnv to true in limits.conf
- name: set_container_true
ini_file:
dest: "{{ splunk.home }}/etc/system/local/limits.conf"
section: default
option: "containerEnv"
value: "{{ splunk.containerEnv }}"
owner: "{{ splunk.user }}"
group: "{{ splunk.group }}"
when:
- splunk.containerEnv is defined
- splunk.containerEnv | bool

# set cgroup path, if defined, in limits.conf
- name: set_cgroup_path
ini_file:
dest: "{{ splunk.home }}/etc/system/local/limits.conf"
section: default
option: "cgroup"
value: "{{ splunk.cgroup }}"
owner: "{{ splunk.user }}"
group: "{{ splunk.group }}"
when:
- splunk.cgroup is defined