- AnsibleFest
- Products
- Community
- Webinars & Training
- Blog

Documentation

# sensu_client – Manages Sensu client configuration

New in version 2.4.

- Synopsis
- Parameters
- Notes
- Examples
- Return Values
- Status

## Synopsis

- Manages Sensu client configuration.
- For more information, refer to the Sensu documentation: https://sensuapp.org/docs/latest/reference/clients.html

## Parameters

Parameter | Choices/Defaults | Comments
--- | --- | ---
address - | Default: "Non-loopback IPv4 address as determined by Ruby Socket.ip_address_list (provided by Sensu)" | An address to help identify and reach the client. This is only informational, usually an IP address or hostname.
chef - |  | The chef definition scope, used to configure the Sensu Enterprise Chef integration (Sensu Enterprise users only).
deregister boolean | Choices: no ← yes | If a deregistration event should be created upon Sensu client process stop.
deregistration - |  | The deregistration definition scope, used to configure automated Sensu client de-registration.
ec2 - |  | The ec2 definition scope, used to configure the Sensu Enterprise AWS EC2 integration (Sensu Enterprise users only).
keepalive - |  | The keepalive definition scope, used to configure Sensu client keepalives behavior (e.g. keepalive thresholds, etc).
keepalives boolean | Choices: no yes ← | If Sensu should monitor keepalives for this client.
name - | Default: "System hostname as determined by Ruby Socket.gethostname (provided by Sensu)" | A unique name for the client. The name cannot contain special characters or spaces.
puppet - |  | The puppet definition scope, used to configure the Sensu Enterprise Puppet integration (Sensu Enterprise users only).
redact - |  | Client definition attributes to redact (values) when logging and sending client keepalives.
registration - |  | The registration definition scope, used to configure Sensu registration event handlers.
safe_mode boolean | Choices: no ← yes | If safe mode is enabled for the client. Safe mode requires local check definitions in order to accept a check request and execute the check.
servicenow - |  | The servicenow definition scope, used to configure the Sensu Enterprise ServiceNow integration (Sensu Enterprise users only).
socket - |  | The socket definition scope, used to configure the Sensu client socket.
state - | Choices: present ← absent | Whether the client should be present or not
subscriptions - / required |  | An array of client subscriptions, a list of roles and/or responsibilities assigned to the system (e.g. webserver). These subscriptions determine which monitoring checks are executed by the client, as check requests are sent to subscriptions. The subscriptions array items must be strings.

## Notes

Note

- Check mode is supported

## Examples

    # Minimum possible configuration
    - name: Configure Sensu client
      sensu_client:
        subscriptions:
          - default

    # With customization
    - name: Configure Sensu client
      sensu_client:
        name: "{{ ansible_fqdn }}"
        address: "{{ ansible_default_ipv4['address'] }}"
        subscriptions:
          - default
          - webserver
        redact:
          - password
        socket:
          bind: 127.0.0.1
          port: 3030
        keepalive:
          thresholds:
            warning: 180
            critical: 300
          handlers:
            - email
          custom:
            - broadcast: irc
          occurrences: 3
      register: client
      notify:
        - Restart sensu-client

    - name: Secure Sensu client configuration file
      file:
        path: "{{ client['file'] }}"
        owner: "sensu"
        group: "sensu"
        mode: "0600"

    - name: Delete the Sensu client configuration
      sensu_client:
        state: "absent"

## Return Values

Common return values are documented here, the following are the fields unique to this module:

Key | Returned | Description
--- | --- | ---
config dictionary | success | Effective client configuration, when state is present Sample: {'name': 'client', 'subscriptions': ['default']}
file string | success | Path to the client configuration file Sample: /etc/sensu/conf.d/client.json

## Status

- This module is not guaranteed to have a backwards compatible interface. [preview]
- This module is maintained by the Ansible Community. [community]

### Authors

- David Moreau Simard (@dmsimard)

Hint

If you notice any issues in this documentation, you can edit this document to improve it.