Debian Codegraph @

ansible_collections/splunk/es/plugins/modules/splunk_investigation.py

raw
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3
4 # Copyright 2026 Red Hat
5 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
6
7 DOCUMENTATION = """
8 ---
9 module: splunk_investigation
10 short_description: Manage Splunk Enterprise Security investigations
11 description:
12 - This module allows for creation and update of Splunk Enterprise Security investigations.
13 - When C(investigation_ref_id) is not provided, a new investigation is created.
14 - When C(investigation_ref_id) is provided, the module will update the existing investigation.
15 - Update operations can modify all fields except C(name).
16 version_added: "5.1.0"
17 options:
18 investigation_ref_id:
19 description:
20 - Reference ID of an existing investigation.
21 - If provided, the module will update the existing investigation.
22 - If not provided, a new investigation is created.
23 - When updating, all fields except C(name) can be modified.
24 type: str
25 name:
26 description:
27 - The name of the investigation.
28 - Required when creating a new investigation (without C(investigation_ref_id)).
29 - Cannot be updated after creation.
30 - Note that names are not unique - multiple investigations can have the same name.
31 type: str
32 description:
33 description:
34 - The description of the investigation.
35 type: str
36 status:
37 description:
38 - The status of the investigation.
39 - Can be updated on existing investigations.
40 type: str
41 choices:
42 - unassigned
43 - new
44 - in_progress
45 - pending
46 - resolved
47 - closed
48 disposition:
49 description:
50 - The disposition of the investigation.
51 - Can be updated on existing investigations.
52 type: str
53 choices:
54 - unassigned
55 - true_positive
56 - benign_positive
57 - false_positive
58 - false_positive_inaccurate_data
59 - other
60 - undetermined
61 owner:
62 description:
63 - The owner of the investigation.
64 - Use C(admin) for the administrator user.
65 - Use C(unassigned) to leave the investigation unassigned.
66 - Can be updated on existing investigations.
67 type: str
68 urgency:
69 description:
70 - The urgency of the investigation.
71 - Can be updated on existing investigations.
72 type: str
73 choices:
74 - informational
75 - low
76 - medium
77 - high
78 - critical
79 - unknown
80 sensitivity:
81 description:
82 - The sensitivity of the investigation.
83 - Can be updated on existing investigations.
84 type: str
85 choices:
86 - white
87 - green
88 - amber
89 - red
90 - unassigned
91 finding_ids:
92 description:
93 - List of finding IDs (event_ids) to attach to the investigation.
94 - When updating, findings are added to the investigation via a separate API call.
95 - Finding IDs can only be added, removal is not supported.
96 type: list
97 elements: str
98 investigation_type:
99 description:
100 - The type of the investigation.
101 - If not specified, the default investigation type is used.
102 - Can be updated on existing investigations.
103 type: str
104 api_namespace:
105 description:
106 - The namespace portion of the Splunk API path.
107 - Override this if your environment uses a different namespace.
108 type: str
109 default: servicesNS
110 api_user:
111 description:
112 - The user portion of the Splunk API path.
113 - Override this if your environment requires a different user context.
114 type: str
115 default: nobody
116 api_app:
117 description:
118 - The app portion of the Splunk API path for the investigations endpoint.
119 - Override this if your environment uses a different app name.
120 type: str
121 default: missioncontrol
122
123 author: Ron Gershburg (@rgershbu)
124 """
125
126 EXAMPLES = """
127 # Create a new investigation
128 - name: Create an investigation
129 splunk.es.splunk_investigation:
130 name: "Security Incident 2026-01"
131 description: "Investigation into suspicious login activity"
132 status: new
133 owner: admin
134 urgency: high
135 sensitivity: amber
136 disposition: undetermined
137
138 # Create an investigation with findings attached
139 - name: Create investigation with findings
140 splunk.es.splunk_investigation:
141 name: "Malware Investigation"
142 description: "Investigation into potential malware detection"
143 status: new
144 owner: admin
145 urgency: critical
146 sensitivity: red
147 finding_ids:
148 - "A265ED94-AE9E-428C-91D2-64BB956EB7CB@@notable@@62eaebb8c0dd2574fc0b3503a9586cd9"
149
150 # Create an investigation with a specific type
151 - name: Create investigation with investigation type
152 splunk.es.splunk_investigation:
153 name: "Phishing Investigation"
154 description: "Investigation into phishing attempt"
155 status: new
156 owner: admin
157 urgency: high
158 investigation_type: "phishing"
159
160 # Update an existing investigation status
161 - name: Update investigation status
162 splunk.es.splunk_investigation:
163 investigation_ref_id: "inv-12345-abcde"
164 status: in_progress
165 owner: analyst1
166
167 # Update investigation disposition
168 - name: Close investigation as resolved
169 splunk.es.splunk_investigation:
170 investigation_ref_id: "inv-12345-abcde"
171 status: resolved
172 disposition: true_positive
173 urgency: low
174
175 # Add findings to an existing investigation
176 - name: Add findings to investigation
177 splunk.es.splunk_investigation:
178 investigation_ref_id: "inv-12345-abcde"
179 finding_ids:
180 - "B376FE05-BF9F-539D-A2E3-75CC067FC8DC@@notable@@73fbccc9d1ee3685gd1c4614b0697de0"
181 """
182
183 RETURN = """
184 investigation:
185 description: The investigation result containing before/after states.
186 returned: always
187 type: dict
188 contains:
189 before:
190 description: The investigation state before module execution (if existed).
191 type: dict
192 returned: when investigation existed
193 after:
194 description: The investigation state after module execution.
195 type: dict
196 returned: always
197 sample:
198 before: null
199 after:
200 name: "Security Incident 2026-01"
201 description: "Investigation into suspicious login activity"
202 status: "new"
203 owner: "admin"
204 urgency: "high"
205 sensitivity: "amber"
206 disposition: "undetermined"
207 investigation_type: "phishing"
208 changed:
209 description: Whether any changes were made.
210 returned: always
211 type: bool
212 sample: true
213 msg:
214 description: Message describing the result.
215 returned: always
216 type: str
217 sample: "Investigation created/updated successfully"
218 """