Skip to content

Commit

Permalink
Extract config docs into dedicated document
Browse files Browse the repository at this point in the history
  • Loading branch information
lkubb committed Sep 26, 2024
1 parent c9e8e46 commit 0f68982
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 69 deletions.
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Salt Extension for interacting with Splunk
:hidden:

topics/installation
topics/configuration

.. toctree::
:maxdepth: 2
Expand Down
28 changes: 28 additions & 0 deletions docs/topics/configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
(splunk-setup)=
# Configuration
## Execution and state modules
Configure execution and state modules by specifying the name of a configuration
profile in the minion config, minion pillar, or master config. The module
will use the 'splunk' key by default, if defined.

For example:

```yaml
splunk:
username: alice
password: abc123
host: example.splunkcloud.com
port: 8080
```
## Returner
The returner requires the following config values to be specified in config or pillar:
```yaml
splunk_http_forwarder:
token: <splunk_http_forwarder_token>
indexer: <hostname/IP of Splunk indexer>
sourcetype: <Destination sourcetype for data>
index: <Destination index for data>
verify_ssl: true
```
24 changes: 3 additions & 21 deletions src/saltext/splunk/modules/splunk.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,8 @@
"""
Module for interop with the Splunk API
Interface with the Splunk API.
.. versionadded:: 2016.3.0
:depends: - splunk-sdk python module
:configuration: Configure this module by specifying the name of a configuration
profile in the minion config, minion pillar, or master config. The module
will use the 'splunk' key by default, if defined.
For example:
.. code-block:: yaml
splunk:
username: alice
password: abc123
host: example.splunkcloud.com
port: 8080
.. important::
This module requires the general :ref:`Splunk setup <splunk-setup>`.
"""

import base64
Expand Down Expand Up @@ -54,9 +39,6 @@


def __virtual__():
"""
Only load this module if splunk is installed on this minion.
"""
if HAS_LIBS:
return __virtualname__
return (
Expand Down
23 changes: 3 additions & 20 deletions src/saltext/splunk/modules/splunk_search.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,8 @@
"""
Module for interop with the Splunk API
Interface with the Splunk search API.
.. versionadded:: 2015.5.0
:depends: - splunk-sdk python module
:configuration: Configure this module by specifying the name of a configuration
profile in the minion config, minion pillar, or master config. The module
will use the 'splunk' key by default, if defined.
For example:
.. code-block:: yaml
splunk:
username: alice
password: abc123
host: example.splunkcloud.com
port: 8080
.. important::
This module requires the general :ref:`Splunk setup <splunk-setup>`.
"""

import logging
Expand Down Expand Up @@ -44,9 +30,6 @@


def __virtual__():
"""
Only load this module if splunk is installed on this minion.
"""
if HAS_LIBS:
return __virtualname__
return (
Expand Down
19 changes: 3 additions & 16 deletions src/saltext/splunk/returners/splunk.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
"""
Send json response data to Splunk via the HTTP Event Collector.
Send json response data to Splunk via the HTTP Event Collector
Requires the following config values to be specified in config or pillar:
.. code-block:: yaml
splunk_http_forwarder:
token: <splunk_http_forwarder_token>
indexer: <hostname/IP of Splunk indexer>
sourcetype: <Destination sourcetype for data>
index: <Destination index for data>
verify_ssl: true
.. important::
This module requires the general :ref:`Splunk setup <splunk-setup>`.
Run a test by using ``salt-call test.ping --return splunk``
Written by Scott Pack (github.com/scottjpack)
"""

import logging
Expand All @@ -35,10 +26,6 @@


def __virtual__():
"""
Return virtual name of the module.
:return: The virtual name of the module.
"""
return __virtualname__


Expand Down
9 changes: 3 additions & 6 deletions src/saltext/splunk/states/splunk.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""
Splunk User State Module
.. versionadded:: 2016.3.0
Statefully manage Splunk users.
Usage
-----
This state is used to ensure presence of users in splunk.
.. code-block:: yaml
Expand All @@ -15,9 +15,6 @@


def __virtual__():
"""
Only load if the splunk module is available in __salt__
"""
if "splunk.list_users" in __salt__:
return "splunk"
return (False, "splunk module could not be loaded")
Expand Down
9 changes: 3 additions & 6 deletions src/saltext/splunk/states/splunk_search.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""
Splunk Search State Module
.. versionadded:: 2015.5.0
Statefully manage Splunk searches.
Usage
-----
This state is used to ensure presence of splunk searches.
.. code-block:: yaml
Expand All @@ -15,9 +15,6 @@


def __virtual__():
"""
Only load if the splunk_search module is available in __salt__
"""
if "splunk_search.get" in __salt__:
return "splunk_search"
return (False, "splunk module could not be loaded")
Expand Down

0 comments on commit 0f68982

Please sign in to comment.