cdillc.splunk.splunk_control module – Control the Splunkd service

Note

This module is part of the cdillc.splunk collection (version 0.26.1).

It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install cdillc.splunk. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: cdillc.splunk.splunk_control.

New in cdillc.splunk 0.10.0

Synopsis

  • Restart the Splunkd service using Ansible.

  • This module uses the Python Splunk SDK and requires access to the splunkd administrative port.

  • Authentication can be handled via either username and password or via token.

Requirements

The below requirements are needed on the host that executes this module.

  • splunk-sdk

Parameters

Parameter

Comments

password

string

The password for username/password authentication.

Must be provided if username is provided.

splunkd_uri

aliases: uri

string

The Splunkd endpoint of the Splunk server to configure.

Defaults to the local server and default splunkd port.

Default: "https://localhost:8089"

state

string

Ensure the service is restarted or offlined.

Choices:

  • "running" ← (default)

  • "restarted"

  • "offlined"

timeout

string

Amount of time (in seconds) to wait for the server to come back online.

Set to 0 to disable the timeout and return immediately.

Default: 300

token

string

Token to use when authentication has already taken place.

The token can be specified instead of username and password.

This module returns an output named token that can be used for subsequent splunkd calls to the same splunkd endpoint.

username

string

Splunk username for username/password authentication.

When provided, password must also be specified.

when_restart_required

string

Only restart if the ‘restart required’ flag has been set.

By default, this module will force a restart.

Choices:

  • true

  • false ← (default)

Examples

- name: Restart the local Splunkd service and wait for it to come back online:
  cdillc.splunk.splunk_control:
    state: restarted
    username: admin
    password: manage

Authors

  • Lowell C. Alleman (@lowell80)