community.general.sensu_client (8.5.0) — module

Manages Sensu client configuration

Authors: David Moreau Simard (@dmsimard)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

Manages Sensu client configuration.

For more information, refer to the Sensu documentation: U(https://sensuapp.org/docs/latest/reference/clients.html)

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Minimum possible configuration
- name: Configure Sensu client
  community.general.sensu_client:
    subscriptions:
      - default
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# With customization
- name: Configure Sensu client
  community.general.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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Secure Sensu client configuration file
  ansible.builtin.file:
    path: "{{ client['file'] }}"
    owner: "sensu"
    group: "sensu"
    mode: "0600"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete the Sensu client configuration
  community.general.sensu_client:
    state: "absent"

Inputs

    
ec2:
    description:
    - The ec2 definition scope, used to configure the Sensu Enterprise AWS EC2 integration
      (Sensu Enterprise users only).
    type: dict

chef:
    description:
    - The chef definition scope, used to configure the Sensu Enterprise Chef integration
      (Sensu Enterprise users only).
    type: dict

name:
    description:
    - A unique name for the client. The name cannot contain special characters or spaces.
    - If not specified, it defaults to the system hostname as determined by Ruby Socket.gethostname
      (provided by Sensu).
    type: str

state:
    choices:
    - present
    - absent
    default: present
    description:
    - Whether the client should be present or not
    type: str

puppet:
    description:
    - The puppet definition scope, used to configure the Sensu Enterprise Puppet integration
      (Sensu Enterprise users only).
    type: dict

redact:
    description:
    - Client definition attributes to redact (values) when logging and sending client
      keepalives.
    elements: str
    type: list

socket:
    description:
    - The socket definition scope, used to configure the Sensu client socket.
    type: dict

address:
    description:
    - An address to help identify and reach the client. This is only informational, usually
      an IP address or hostname.
    - If not specified it defaults to non-loopback IPv4 address as determined by Ruby
      Socket.ip_address_list (provided by Sensu).
    type: str

keepalive:
    description:
    - The keepalive definition scope, used to configure Sensu client keepalives behavior
      (e.g. keepalive thresholds, etc).
    type: dict

safe_mode:
    default: false
    description:
    - 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.
    type: bool

deregister:
    description:
    - If a deregistration event should be created upon Sensu client process stop.
    - Default is V(false).
    type: bool

keepalives:
    default: true
    description:
    - If Sensu should monitor keepalives for this client.
    type: bool

servicenow:
    description:
    - The servicenow definition scope, used to configure the Sensu Enterprise ServiceNow
      integration (Sensu Enterprise users only).
    type: dict

registration:
    description:
    - The registration definition scope, used to configure Sensu registration event handlers.
    type: dict

subscriptions:
    description:
    - 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.
    elements: str
    type: list

deregistration:
    description:
    - The deregistration definition scope, used to configure automated Sensu client de-registration.
    type: dict

Outputs

config:
  description: Effective client configuration, when state is present
  returned: success
  sample:
    name: client
    subscriptions:
    - default
  type: dict
file:
  description: Path to the client configuration file
  returned: success
  sample: /etc/sensu/conf.d/client.json
  type: str