Skip to content

api_key

lucasheld edited this page Aug 29, 2023 · 5 revisions

lucasheld.uptime_kuma.api_key module -- Manages api keys.

Note

This module is part of the lucasheld.uptime_kuma collection (version 1.2.0).

You might already have this collection installed if you are using the ansible package. 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 lucasheld.uptime_kuma.

To use it in a playbook, specify: lucasheld.uptime_kuma.api_key.

Synopsis

  • Manages api keys.

Requirements

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

  • uptime-kuma-api

Parameters

Parameter

Comments

active

boolean

True to activate the api key.

Choices:

  • no

  • yes

api_headers

dictionary

Headers that are passed to the socketio connection.

api_password

string

The Uptime Kuma password.

Only required if no api_token specified and authentication is enabled.

api_ssl_verify

boolean

true to verify SSL certificates, or false to skip SSL certificate verification,

allowing connections to servers with self signed certificates.

Choices:

  • no

  • yes ← (default)

api_timeout

float

How many seconds the client should wait for the connection, an expected event or a server response.

Default: 10

api_token

string

The Uptime Kuma login token.

Only required if no api_username and api_password specified and authentication is enabled.

api_url

string

The Uptime Kuma URL.

Default: "http://127.0.0.1:3001"

api_username

string

The Uptime Kuma username.

Only required if no api_token specified and authentication is enabled.

api_wait_events

float

How many seconds the client should wait for the next event of the same type.

There is no way to determine when the last message of a certain type has arrived. Therefore, a timeout is required.

If no further message has arrived within this time, it is assumed that it was the last message.

Default: 0.2

expires

string

The expiration date of the api key.

id

integer

The id of the api key.

Only required if no name specified.

name

string

The name of the api key.

Only required if no id specified.

state

string

Set to present to create an api key.

Set to absent to delete an api key.

Set to enabled to enable an api key.

Set to disabled to disable an api key.

Choices:

  • present ← (default)

  • absent

  • enabled

  • disabled

Examples

- name: Add api key
  lucasheld.uptime_kuma.api_key:
    api_url: http://127.0.0.1:3001
    api_username: admin
    api_password: secret123
    name: api key 1
    expires: "2023-03-30 12:20:00"
    active: true
  register: result
- name: Extract the api key from the result and set it as fact
  set_fact:
    api_key: "{{ result.key }}"

- name: Enable api key
  lucasheld.uptime_kuma.api_key:
    api_url: http://127.0.0.1:3001
    api_username: admin
    api_password: secret123
    name: api key 1
    state: enabled

- name: Disable api key
  lucasheld.uptime_kuma.api_key:
    api_url: http://127.0.0.1:3001
    api_username: admin
    api_password: secret123
    name: api key 1
    state: disabled

- name: Remove api key
  lucasheld.uptime_kuma.api_key:
    api_url: http://127.0.0.1:3001
    api_username: admin
    api_password: secret123
    name: api key 1
    state: absent

Authors

  • Lucas Held (@lucasheld)

Issue Tracker Repository (Sources)