| 1 |
# Splunk Enterprise Security Ansible Collection |
| 2 |
|
| 3 |
[](https://github.com/ansible-collections/splunk.es/actions/workflows/tests.yml) |
| 4 |
[](https://github.com/ansible-collections/splunk.es/actions/workflows/network_integration.yml) |
| 5 |
[](https://sonarcloud.io/project/overview?id=ansible-collections_splunk.es) |
| 6 |
|
| 7 |
This is the [Ansible |
| 8 |
Collection](https://docs.ansible.com/ansible/latest/user_guide/collections_using.html) |
| 9 |
provided by the [Ansible Security Automation |
| 10 |
Team](https://github.com/ansible-security) for automating actions in |
| 11 |
[Splunk Enterprise Security SIEM](https://www.splunk.com/en_us/software/enterprise-security.html) |
| 12 |
|
| 13 |
This Collection is meant for distribution through |
| 14 |
[Ansible Galaxy](https://galaxy.ansible.com/) as is available for all |
| 15 |
[Ansible](https://github.com/ansible/ansible) users to utilize, contribute to, |
| 16 |
and provide feedback about. |
| 17 |
|
| 18 |
## Communication |
| 19 |
|
| 20 |
* Join the Ansible forum: |
| 21 |
* [Get Help](https://forum.ansible.com/c/help/6): get help or help others. |
| 22 |
* [Posts tagged with 'security'](https://forum.ansible.com/tag/security): subscribe to participate in collection-related conversations. |
| 23 |
* [Social Spaces](https://forum.ansible.com/c/chat/4): gather and interact with fellow enthusiasts. |
| 24 |
* [News & Announcements](https://forum.ansible.com/c/news/5): track project-wide announcements including social events. |
| 25 |
|
| 26 |
* The Ansible [Bullhorn newsletter](https://docs.ansible.com/ansible/devel/community/communication.html#the-bullhorn): used to announce releases and important changes. |
| 27 |
|
| 28 |
For more information about communication, see the [Ansible communication guide](https://docs.ansible.com/ansible/devel/community/communication.html). |
| 29 |
|
| 30 |
## Support |
| 31 |
|
| 32 |
As a Red Hat Ansible [Certified Content](https://catalog.redhat.com/software/search?target_platforms=Red%20Hat%20Ansible%20Automation%20Platform), this collection is entitled to [support](https://access.redhat.com/support/) through [Ansible Automation Platform](https://www.redhat.com/en/technologies/management/ansible) (AAP). |
| 33 |
|
| 34 |
If a support case cannot be opened with Red Hat and the collection has been obtained either from [Galaxy](https://galaxy.ansible.com/ui/) or [GitHub](https://github.com/ansible-collections/splunk.es), there is community support available at no charge. |
| 35 |
|
| 36 |
<!--start requires_ansible--> |
| 37 |
## Ansible version compatibility |
| 38 |
|
| 39 |
This collection has been tested against the following Ansible versions: **>=2.17.0**. |
| 40 |
|
| 41 |
Plugins and modules within a collection may be tested with only specific Ansible versions. |
| 42 |
A collection may contain metadata that identifies these versions. |
| 43 |
PEP440 is the schema used to describe the versions of Ansible. |
| 44 |
<!--end requires_ansible--> |
| 45 |
|
| 46 |
## Collection Content |
| 47 |
|
| 48 |
<!--start collection content--> |
| 49 |
### Httpapi plugins |
| 50 |
Name | Description |
| 51 |
--- | --- |
| 52 |
[splunk.es.splunk](https://github.com/ansible-collections/splunk.es/blob/main/docs/splunk.es.splunk_httpapi.rst)|HttpApi Plugin for Splunk |
| 53 |
|
| 54 |
### Modules |
| 55 |
Name | Description |
| 56 |
--- | --- |
| 57 |
[splunk.es.splunk_adaptive_response_notable_events](https://github.com/ansible-collections/splunk.es/blob/main/docs/splunk.es.splunk_adaptive_response_notable_events_module.rst)|Manage Adaptive Responses notable events resource module |
| 58 |
[splunk.es.splunk_correlation_search_info](https://github.com/ansible-collections/splunk.es/blob/main/docs/splunk.es.splunk_correlation_search_info_module.rst)|Gather information about Splunk Enterprise Security Correlation Searches |
| 59 |
[splunk.es.splunk_correlation_searches](https://github.com/ansible-collections/splunk.es/blob/main/docs/splunk.es.splunk_correlation_searches_module.rst)|Splunk Enterprise Security Correlation searches resource module |
| 60 |
[splunk.es.splunk_data_inputs_monitor](https://github.com/ansible-collections/splunk.es/blob/main/docs/splunk.es.splunk_data_inputs_monitor_module.rst)|Splunk Data Inputs of type Monitor resource module |
| 61 |
[splunk.es.splunk_data_inputs_network](https://github.com/ansible-collections/splunk.es/blob/main/docs/splunk.es.splunk_data_inputs_network_module.rst)|Manage Splunk Data Inputs of type TCP or UDP resource module |
| 62 |
[splunk.es.splunk_finding](https://github.com/ansible-collections/splunk.es/blob/main/docs/splunk.es.splunk_finding_module.rst)|Manage Splunk Enterprise Security findings |
| 63 |
[splunk.es.splunk_finding_info](https://github.com/ansible-collections/splunk.es/blob/main/docs/splunk.es.splunk_finding_info_module.rst)|Gather information about Splunk Enterprise Security Findings |
| 64 |
[splunk.es.splunk_investigation](https://github.com/ansible-collections/splunk.es/blob/main/docs/splunk.es.splunk_investigation_module.rst)|Manage Splunk Enterprise Security investigations |
| 65 |
[splunk.es.splunk_investigation_info](https://github.com/ansible-collections/splunk.es/blob/main/docs/splunk.es.splunk_investigation_info_module.rst)|Gather information about Splunk Enterprise Security Investigations |
| 66 |
[splunk.es.splunk_investigation_type](https://github.com/ansible-collections/splunk.es/blob/main/docs/splunk.es.splunk_investigation_type_module.rst)|Manage Splunk Enterprise Security investigation types |
| 67 |
[splunk.es.splunk_investigation_type_info](https://github.com/ansible-collections/splunk.es/blob/main/docs/splunk.es.splunk_investigation_type_info_module.rst)|Gather information about Splunk Enterprise Security investigation types |
| 68 |
[splunk.es.splunk_notes](https://github.com/ansible-collections/splunk.es/blob/main/docs/splunk.es.splunk_notes_module.rst)|Manage notes for findings, investigations, and response plan tasks |
| 69 |
[splunk.es.splunk_notes_info](https://github.com/ansible-collections/splunk.es/blob/main/docs/splunk.es.splunk_notes_info_module.rst)|Gather information about notes in Splunk Enterprise Security |
| 70 |
[splunk.es.splunk_response_plan](https://github.com/ansible-collections/splunk.es/blob/main/docs/splunk.es.splunk_response_plan_module.rst)|Manage Splunk Enterprise Security response plans |
| 71 |
[splunk.es.splunk_response_plan_execution](https://github.com/ansible-collections/splunk.es/blob/main/docs/splunk.es.splunk_response_plan_execution_module.rst)|Apply response plans to investigations and manage tasks |
| 72 |
[splunk.es.splunk_response_plan_execution_info](https://github.com/ansible-collections/splunk.es/blob/main/docs/splunk.es.splunk_response_plan_execution_info_module.rst)|Gather information about applied response plans on an investigation |
| 73 |
[splunk.es.splunk_response_plan_info](https://github.com/ansible-collections/splunk.es/blob/main/docs/splunk.es.splunk_response_plan_info_module.rst)|Gather information about Splunk Enterprise Security response plans |
| 74 |
|
| 75 |
<!--end collection content--> |
| 76 |
|
| 77 |
### Supported connections |
| 78 |
|
| 79 |
Use splunk modules with the [`httpapi` connection |
| 80 |
plugin](https://docs.ansible.com/ansible/latest/plugins/connection/httpapi.html). |
| 81 |
Set certain attributes in the inventory as follows: |
| 82 |
|
| 83 |
Example `inventory.ini`: |
| 84 |
|
| 85 |
**NOTE:** The passwords should be stored in a secure location or an [Ansible |
| 86 |
Vault](https://docs.ansible.com/ansible/latest/user_guide/vault.html) |
| 87 |
|
| 88 |
**NOTE:** the default port for Splunk's REST API is 8089 |
| 89 |
|
| 90 |
[splunk] |
| 91 |
splunk.example.com |
| 92 |
|
| 93 |
[splunk:vars] |
| 94 |
ansible_network_os=splunk.es.splunk |
| 95 |
ansible_user=admin |
| 96 |
ansible_httpapi_pass=my_super_secret_admin_password |
| 97 |
ansible_httpapi_port=8089 |
| 98 |
ansible_httpapi_use_ssl=yes |
| 99 |
ansible_httpapi_validate_certs=True |
| 100 |
ansible_connection=httpapi |
| 101 |
|
| 102 |
## Installing this collection |
| 103 |
|
| 104 |
You can install the splunk collection with the Ansible Galaxy CLI: |
| 105 |
|
| 106 |
ansible-galaxy collection install splunk.es |
| 107 |
|
| 108 |
You can also include it in a `requirements.yml` file and install it with `ansible-galaxy collection install -r requirements.yml`, using the format: |
| 109 |
|
| 110 |
```yaml |
| 111 |
--- |
| 112 |
collections: |
| 113 |
- name: splunk.es |
| 114 |
``` |
| 115 |
|
| 116 |
## Using this collection |
| 117 |
|
| 118 |
**NOTE**: For Ansible 2.9, you may not see deprecation warnings when you run your playbooks with this collection. Use this documentation to track when a module is deprecated. |
| 119 |
|
| 120 |
An example of using this collection to manage a log source with [Splunk Enterprise Security SIEM](https://www.splunk.com/en_us/software/enterprise-security.html) is as follows. |
| 121 |
|
| 122 |
`inventory.ini` (Note the password should be managed by a [Vault](https://docs.ansible.com/ansible/latest/user_guide/vault.html) for a production environment. |
| 123 |
|
| 124 |
``` |
| 125 |
[splunk] |
| 126 |
splunk.example.com |
| 127 |
|
| 128 |
[splunk:vars] |
| 129 |
ansible_network_os=splunk.es.splunk |
| 130 |
ansible_user=admin |
| 131 |
ansible_httpapi_pass=my_super_secret_admin_password |
| 132 |
ansible_httpapi_port=8089 |
| 133 |
ansible_httpapi_use_ssl=yes |
| 134 |
ansible_httpapi_validate_certs=True |
| 135 |
ansible_connection=httpapi |
| 136 |
``` |
| 137 |
|
| 138 |
### Using the modules with Fully Qualified Collection Name (FQCN) |
| 139 |
|
| 140 |
With [Ansible |
| 141 |
Collections](https://docs.ansible.com/ansible/latest/dev_guide/developing_collections.html) |
| 142 |
there are various ways to utilize them either by calling specific Content from |
| 143 |
the Collection, such as a module, by its Fully Qualified Collection Name (FQCN) |
| 144 |
as we'll show in this example or by defining a Collection Search Path as the |
| 145 |
examples below will display. |
| 146 |
|
| 147 |
We recommend the FQCN method but the |
| 148 |
shorthand options listed below exist for convenience. |
| 149 |
|
| 150 |
`splunk_with_collections_fqcn_example.yml` |
| 151 |
|
| 152 |
``` |
| 153 |
--- |
| 154 |
- name: demo splunk |
| 155 |
hosts: splunk |
| 156 |
gather_facts: false |
| 157 |
tasks: |
| 158 |
- name: test splunk_data_input_monitor |
| 159 |
splunk.es.data_input_monitor: |
| 160 |
name: "/var/log/demo.log" |
| 161 |
state: "present" |
| 162 |
recursive: true |
| 163 |
- name: test splunk_data_input_network |
| 164 |
splunk.es.data_input_network: |
| 165 |
name: "9001" |
| 166 |
protocol: "tcp" |
| 167 |
state: "absent" |
| 168 |
- name: test splunk_coorelation_search |
| 169 |
splunk.es.correlation_search: |
| 170 |
name: "Test Demo Coorelation Search From Playbook" |
| 171 |
description: "Test Demo Coorelation Search From Playbook, description." |
| 172 |
search: 'source="/var/log/snort.log"' |
| 173 |
state: "present" |
| 174 |
- name: test splunk_adaptive_response_notable_event |
| 175 |
splunk.es.adaptive_response_notable_event: |
| 176 |
name: "Demo notable event from playbook" |
| 177 |
correlation_search_name: "Test Demo Coorelation Search From Playbook" |
| 178 |
description: "Test Demo notable event from playbook, description." |
| 179 |
state: "present" |
| 180 |
next_steps: |
| 181 |
- ping |
| 182 |
- nslookup |
| 183 |
recommended_actions: |
| 184 |
- script |
| 185 |
``` |
| 186 |
|
| 187 |
### Define your collection search path at the Play level |
| 188 |
|
| 189 |
Below we specify our collection at the Play level which allows us to use the |
| 190 |
splunk modules without specifying the need for the FQCN. |
| 191 |
|
| 192 |
`splunk_with_collections_example.yml` |
| 193 |
|
| 194 |
``` |
| 195 |
--- |
| 196 |
- name: demo splunk |
| 197 |
hosts: splunk |
| 198 |
gather_facts: false |
| 199 |
collections: |
| 200 |
- splunk.es |
| 201 |
tasks: |
| 202 |
- name: test splunk_data_input_monitor |
| 203 |
data_input_monitor: |
| 204 |
name: "/var/log/demo.log" |
| 205 |
state: "present" |
| 206 |
recursive: true |
| 207 |
- name: test splunk_data_input_network |
| 208 |
data_input_network: |
| 209 |
name: "9001" |
| 210 |
protocol: "tcp" |
| 211 |
state: "absent" |
| 212 |
- name: test splunk_coorelation_search |
| 213 |
correlation_search: |
| 214 |
name: "Test Demo Coorelation Search From Playbook" |
| 215 |
description: "Test Demo Coorelation Search From Playbook, description." |
| 216 |
search: 'source="/var/log/snort.log"' |
| 217 |
state: "present" |
| 218 |
- name: test splunk_adaptive_response_notable_event |
| 219 |
adaptive_response_notable_event: |
| 220 |
name: "Demo notable event from playbook" |
| 221 |
correlation_search_name: "Test Demo Coorelation Search From Playbook" |
| 222 |
description: "Test Demo notable event from playbook, description." |
| 223 |
state: "present" |
| 224 |
next_steps: |
| 225 |
- ping |
| 226 |
- nslookup |
| 227 |
recommended_actions: |
| 228 |
- script |
| 229 |
``` |
| 230 |
|
| 231 |
### Define your collection search path at the Block level |
| 232 |
|
| 233 |
Below we use the [`block`](https://docs.ansible.com/ansible/latest/user_guide/playbooks_blocks.html) |
| 234 |
level keyword, we are able to use the splunk modules without the need for the |
| 235 |
FQCN. |
| 236 |
|
| 237 |
`splunk_with_collections_block_example.yml` |
| 238 |
|
| 239 |
``` |
| 240 |
--- |
| 241 |
- name: demo splunk |
| 242 |
hosts: splunk |
| 243 |
gather_facts: false |
| 244 |
tasks: |
| 245 |
- name: collection namespace block |
| 246 |
- name: test splunk_data_input_monitor |
| 247 |
data_input_monitor: |
| 248 |
name: "/var/log/demo.log" |
| 249 |
state: "present" |
| 250 |
recursive: true |
| 251 |
- name: test splunk_data_input_network |
| 252 |
data_input_network: |
| 253 |
name: "9001" |
| 254 |
protocol: "tcp" |
| 255 |
state: "absent" |
| 256 |
- name: test splunk_coorelation_search |
| 257 |
correlation_search: |
| 258 |
name: "Test Demo Coorelation Search From Playbook" |
| 259 |
description: "Test Demo Coorelation Search From Playbook, description." |
| 260 |
search: 'source="/var/log/snort.log"' |
| 261 |
state: "present" |
| 262 |
- name: test splunk_adaptive_response_notable_event |
| 263 |
adaptive_response_notable_event: |
| 264 |
name: "Demo notable event from playbook" |
| 265 |
correlation_search_name: "Test Demo Coorelation Search From Playbook" |
| 266 |
description: "Test Demo notable event from playbook, description." |
| 267 |
state: "present" |
| 268 |
next_steps: |
| 269 |
- ping |
| 270 |
- nslookup |
| 271 |
recommended_actions: |
| 272 |
- script |
| 273 |
collections: |
| 274 |
- splunk.es |
| 275 |
``` |
| 276 |
|
| 277 |
## Contributing to this collection |
| 278 |
|
| 279 |
We welcome community contributions to this collection. If you find problems, please open an issue or create a PR against the [Splunk collection repository](https://github.com/ansible-collections/splunk.es). See [Contributing to Ansible-maintained collections](https://docs.ansible.com/ansible/devel/community/contributing_maintained_collections.html#contributing-maintained-collections) for complete details. |
| 280 |
|
| 281 |
You can also join us on: |
| 282 |
|
| 283 |
- IRC - the `#ansible-security` [irc.libera.chat](https://libera.chat/) channel |
| 284 |
|
| 285 |
See the [Ansible Community Guide](https://docs.ansible.com/ansible/latest/community/index.html) for details on contributing to Ansible. |
| 286 |
|
| 287 |
### Code of Conduct |
| 288 |
|
| 289 |
This collection follows the Ansible project's |
| 290 |
[Code of Conduct](https://docs.ansible.com/ansible/devel/community/code_of_conduct.html). |
| 291 |
Please read and familiarize yourself with this document. |
| 292 |
|
| 293 |
## Release notes |
| 294 |
|
| 295 |
Release notes are available [here](https://github.com/ansible-collections/splunk.es/blob/main/changelogs/CHANGELOG.rst). |
| 296 |
|
| 297 |
## Roadmap |
| 298 |
|
| 299 |
<!-- Optional. Include the roadmap for this collection, and the proposed release/versioning strategy so users can anticipate the upgrade/update cycle. --> |
| 300 |
|
| 301 |
## More information |
| 302 |
|
| 303 |
- [Ansible network resources](https://docs.ansible.com/ansible/latest/network/getting_started/network_resources.html) |
| 304 |
- [Ansible Collection overview](https://github.com/ansible-collections/overview) |
| 305 |
- [Ansible User guide](https://docs.ansible.com/ansible/latest/user_guide/index.html) |
| 306 |
- [Ansible Developer guide](https://docs.ansible.com/ansible/latest/dev_guide/index.html) |
| 307 |
- [Ansible Community code of conduct](https://docs.ansible.com/ansible/latest/community/code_of_conduct.html) |
| 308 |
|
| 309 |
## Licensing |
| 310 |
|
| 311 |
GNU General Public License v3.0 or later. |
| 312 |
|
| 313 |
See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) to see the full text. |
| 314 |
|
| 315 |
## Author Information |
| 316 |
|
| 317 |
[Ansible Security Automation Team](https://github.com/ansible-security) |