community.general.sensu_silence (8.5.0) — module

Manage Sensu silence entries

Authors: Steven Bambling (@smbambling)

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

Create and clear (delete) a silence entries via the Sensu API for subscriptions and checks.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Silence ALL checks for a given client
- name: Silence server1.example.dev
  community.general.sensu_silence:
    subscription: client:server1.example.dev
    creator: "{{ ansible_user_id }}"
    reason: Performing maintenance
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Silence specific check for a client
- name: Silence CPU_Usage check for server1.example.dev
  community.general.sensu_silence:
    subscription: client:server1.example.dev
    check: CPU_Usage
    creator: "{{ ansible_user_id }}"
    reason: Investigation alert issue

# Silence multiple clients from a dict
  silence:
    server1.example.dev:
      reason: 'Deployment in progress'
    server2.example.dev:
      reason: 'Deployment in progress'
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Silence several clients from a dict
  community.general.sensu_silence:
    subscription: "client:{{ item.key }}"
    reason: "{{ item.value.reason }}"
    creator: "{{ ansible_user_id }}"
  with_dict: "{{ silence }}"

Inputs

    
url:
    default: http://127.0.01:4567
    description:
    - Specifies the URL of the Sensu monitoring host server.
    required: false
    type: str

check:
    description:
    - Specifies the check which the silence entry applies to.
    type: str

state:
    choices:
    - present
    - absent
    default: present
    description:
    - Specifies to create or clear (delete) a silence entry via the Sensu API
    type: str

expire:
    description:
    - If specified, the silence entry will be automatically cleared after this number
      of seconds.
    type: int

reason:
    description:
    - If specified, this free-form string is used to provide context or rationale for
      the reason this silence entry was created.
    type: str

creator:
    description:
    - Specifies the entity responsible for this entry.
    type: str

subscription:
    description:
    - Specifies the subscription which the silence entry applies to.
    - To create a silence entry for a client prepend C(client:) to client name. Example
      - C(client:server1.example.dev)
    required: true
    type: str

expire_on_resolve:
    description:
    - If specified as true, the silence entry will be automatically cleared once the condition
      it is silencing is resolved.
    type: bool