| 1 |
#!/usr/bin/python |
| 2 |
# -*- coding: utf-8 -*- |
| 3 |
|
| 4 |
# Copyright 2026 Red Hat Inc. |
| 5 |
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) |
| 6 |
|
| 7 |
|
| 8 |
DOCUMENTATION = """ |
| 9 |
--- |
| 10 |
module: splunk_notes_info |
| 11 |
short_description: Gather information about notes in Splunk Enterprise Security |
| 12 |
description: |
| 13 |
- This module allows for querying information about notes in Splunk Enterprise Security. |
| 14 |
- Notes can be queried from findings, investigations, or response plan tasks. |
| 15 |
- Use C(target_type) to specify where to query notes from. |
| 16 |
- Query by C(note_id) to fetch a specific note. |
| 17 |
- Use C(limit) to control the maximum number of notes returned. |
| 18 |
- This module is read-only and does not make any changes. |
| 19 |
version_added: "5.1.0" |
| 20 |
options: |
| 21 |
target_type: |
| 22 |
description: |
| 23 |
- The type of object to query notes from. |
| 24 |
- Use C(finding) to query notes from a security finding. |
| 25 |
- Use C(investigation) to query notes from an investigation. |
| 26 |
- Use C(response_plan_task) to query notes from a task within an applied response plan. |
| 27 |
type: str |
| 28 |
required: true |
| 29 |
choices: |
| 30 |
- finding |
| 31 |
- investigation |
| 32 |
- response_plan_task |
| 33 |
finding_ref_id: |
| 34 |
description: |
| 35 |
- The reference ID of the finding to query notes from. |
| 36 |
- Required when C(target_type=finding). |
| 37 |
- Format is typically C(uuid@@notable@@time{timestamp}). |
| 38 |
- The C(notable_time) query parameter is automatically extracted from this ID. |
| 39 |
type: str |
| 40 |
investigation_ref_id: |
| 41 |
description: |
| 42 |
- The investigation UUID. |
| 43 |
- Required when C(target_type=investigation) or C(target_type=response_plan_task). |
| 44 |
type: str |
| 45 |
response_plan_id: |
| 46 |
description: |
| 47 |
- The ID of the applied response plan. |
| 48 |
- Required when C(target_type=response_plan_task). |
| 49 |
type: str |
| 50 |
phase_id: |
| 51 |
description: |
| 52 |
- The ID of the phase containing the task. |
| 53 |
- Required when C(target_type=response_plan_task). |
| 54 |
type: str |
| 55 |
task_id: |
| 56 |
description: |
| 57 |
- The ID of the task to query notes from. |
| 58 |
- Required when C(target_type=response_plan_task). |
| 59 |
type: str |
| 60 |
note_id: |
| 61 |
description: |
| 62 |
- The ID of a specific note to retrieve. |
| 63 |
- If specified, returns only the note with this ID. |
| 64 |
- For C(response_plan_task), this enables direct API lookup. |
| 65 |
- For C(finding) and C(investigation), notes are fetched and filtered by ID. |
| 66 |
type: str |
| 67 |
limit: |
| 68 |
description: |
| 69 |
- Maximum number of notes to return. |
| 70 |
- Defaults to 100 if not specified. |
| 71 |
- Ignored when C(note_id) is provided. |
| 72 |
type: int |
| 73 |
default: 100 |
| 74 |
api_namespace: |
| 75 |
description: |
| 76 |
- The namespace portion of the Splunk API path. |
| 77 |
- Override this if your environment uses a different namespace. |
| 78 |
type: str |
| 79 |
default: servicesNS |
| 80 |
api_user: |
| 81 |
description: |
| 82 |
- The user portion of the Splunk API path. |
| 83 |
- Override this if your environment requires a different user context. |
| 84 |
type: str |
| 85 |
default: nobody |
| 86 |
api_app: |
| 87 |
description: |
| 88 |
- The app portion of the Splunk API path. |
| 89 |
- Override this if your environment uses a different app name. |
| 90 |
type: str |
| 91 |
default: missioncontrol |
| 92 |
|
| 93 |
author: Ron Gershburg (@rgershbu) |
| 94 |
""" |
| 95 |
|
| 96 |
EXAMPLES = """ |
| 97 |
# Query all notes from a finding |
| 98 |
- name: Get all notes from a finding |
| 99 |
splunk.es.splunk_notes_info: |
| 100 |
target_type: finding |
| 101 |
finding_ref_id: "2008e99d-af14-4fec-89da-b9b17a81820a@@notable@@time1768225865" |
| 102 |
register: finding_notes |
| 103 |
|
| 104 |
- name: Display finding notes |
| 105 |
debug: |
| 106 |
var: finding_notes.notes |
| 107 |
|
| 108 |
# Query all notes from an investigation |
| 109 |
- name: Get all notes from an investigation |
| 110 |
splunk.es.splunk_notes_info: |
| 111 |
target_type: investigation |
| 112 |
investigation_ref_id: "590afa9c-23d5-4377-b909-cd2cfa1bc0f1" |
| 113 |
register: investigation_notes |
| 114 |
|
| 115 |
# Query all notes from a response plan task |
| 116 |
- name: Get all notes from a response plan task |
| 117 |
splunk.es.splunk_notes_info: |
| 118 |
target_type: response_plan_task |
| 119 |
investigation_ref_id: "590afa9c-23d5-4377-b909-cd2cfa1bc0f1" |
| 120 |
response_plan_id: "b9ef7dce-6dcd-4900-b5d5-982fc194554a" |
| 121 |
phase_id: "phase-001" |
| 122 |
task_id: "task-001" |
| 123 |
register: task_notes |
| 124 |
|
| 125 |
# Query a specific note by ID from a finding |
| 126 |
- name: Get specific note from a finding |
| 127 |
splunk.es.splunk_notes_info: |
| 128 |
target_type: finding |
| 129 |
finding_ref_id: "2008e99d-af14-4fec-89da-b9b17a81820a@@notable@@time1768225865" |
| 130 |
note_id: "note-abc123" |
| 131 |
register: specific_note |
| 132 |
|
| 133 |
# Query a specific note by ID from a response plan task |
| 134 |
- name: Get specific note from a response plan task |
| 135 |
splunk.es.splunk_notes_info: |
| 136 |
target_type: response_plan_task |
| 137 |
investigation_ref_id: "590afa9c-23d5-4377-b909-cd2cfa1bc0f1" |
| 138 |
response_plan_id: "b9ef7dce-6dcd-4900-b5d5-982fc194554a" |
| 139 |
phase_id: "phase-001" |
| 140 |
task_id: "task-001" |
| 141 |
note_id: "note-xyz789" |
| 142 |
register: specific_task_note |
| 143 |
|
| 144 |
# Query notes with a custom limit |
| 145 |
- name: Get latest 10 notes from an investigation |
| 146 |
splunk.es.splunk_notes_info: |
| 147 |
target_type: investigation |
| 148 |
investigation_ref_id: "590afa9c-23d5-4377-b909-cd2cfa1bc0f1" |
| 149 |
limit: 10 |
| 150 |
register: limited_notes |
| 151 |
|
| 152 |
# Query notes with custom API configuration |
| 153 |
- name: Get notes with custom API path |
| 154 |
splunk.es.splunk_notes_info: |
| 155 |
target_type: investigation |
| 156 |
investigation_ref_id: "590afa9c-23d5-4377-b909-cd2cfa1bc0f1" |
| 157 |
api_namespace: "{{ es_namespace | default('servicesNS') }}" |
| 158 |
api_user: "{{ es_user | default('nobody') }}" |
| 159 |
api_app: "{{ es_app | default('missioncontrol') }}" |
| 160 |
register: custom_notes |
| 161 |
""" |
| 162 |
|
| 163 |
RETURN = """ |
| 164 |
notes: |
| 165 |
description: List of notes matching the query. |
| 166 |
returned: always |
| 167 |
type: list |
| 168 |
elements: dict |
| 169 |
contains: |
| 170 |
note_id: |
| 171 |
description: The unique identifier of the note. |
| 172 |
type: str |
| 173 |
content: |
| 174 |
description: The content/body of the note. |
| 175 |
type: str |
| 176 |
sample: |
| 177 |
- note_id: "note-abc123" |
| 178 |
content: "Initial investigation shows suspicious activity from external IP." |
| 179 |
- note_id: "note-def456" |
| 180 |
content: "Escalating to security team for further analysis." |
| 181 |
changed: |
| 182 |
description: Whether any changes were made. Always false for info modules. |
| 183 |
returned: always |
| 184 |
type: bool |
| 185 |
sample: false |
| 186 |
""" |