Merge pull request #84 from corvus-migratorius/fix-uptime-kuma

Fix uptime-kuma role
This commit is contained in:
Alexander Gorelyshev
2026-03-14 21:01:01 +04:00
committed by GitHub
2 changed files with 20 additions and 20 deletions

View File

@@ -13,12 +13,12 @@
ansible.builtin.include_role: ansible.builtin.include_role:
name: "genlab.common.uptime_kuma" name: "genlab.common.uptime_kuma"
vars: vars:
kuma_api_username: "{{ test_admin_username }}" uptime_kuma_api_username: "{{ test_admin_username }}"
kuma_api_password: "{{ test_admin_password }}" uptime_kuma_api_password: "{{ test_admin_password }}"
kuma_tg_bot_token: 8161628020:AAF9doUFKSwdK4NZ8z58zVpqq0H1EdrKnI1 uptime_kuma_tg_bot_token: 8161628020:AAF9doUFKSwdK4NZ8z58zVpqq0H1EdrKnI1
kuma_tg_chat_id: -4877676122 uptime_kuma_tg_chat_id: -4877676122
uptime_kuma_default_notification_names: ["Telegram alerts"] uptime_kuma_default_notification_names: ["Telegram alerts"]
kuma_monitors: uptime_kuma_monitors:
- name: "push-test" - name: "push-test"
type: push type: push
interval: 30 interval: 30

View File

@@ -7,15 +7,15 @@
- name: "Set up uptime-kuma credentials" - name: "Set up uptime-kuma credentials"
lucasheld.uptime_kuma.setup: lucasheld.uptime_kuma.setup:
api_url: http://127.0.0.1:{{ uptime_kuma_port }} api_url: http://127.0.0.1:{{ uptime_kuma_port }}
api_username: "{{ kuma_api_username }}" api_username: "{{ uptime_kuma_api_username }}"
api_password: "{{ kuma_api_password }}" api_password: "{{ uptime_kuma_api_password }}"
- name: "Login with credentials once and register the result" - name: "Login with credentials once and register the result"
register: uptime_kuma_result register: uptime_kuma_result
lucasheld.uptime_kuma.login: lucasheld.uptime_kuma.login:
api_url: http://127.0.0.1:{{ uptime_kuma_port }} api_url: http://127.0.0.1:{{ uptime_kuma_port }}
api_username: "{{ kuma_api_username }}" api_username: "{{ uptime_kuma_api_username }}"
api_password: "{{ kuma_api_password }}" api_password: "{{ uptime_kuma_api_password }}"
- name: "Extract the token from the result and set it as fact" - name: "Extract the token from the result and set it as fact"
ansible.builtin.set_fact: ansible.builtin.set_fact:
@@ -23,22 +23,22 @@
- name: "Configure Telegram notification method" - name: "Configure Telegram notification method"
when: when:
- kuma_tg_bot_token is defined - uptime_kuma_tg_bot_token is defined
- kuma_tg_chat_id is defined - uptime_kuma_tg_chat_id is defined
lucasheld.uptime_kuma.notification: lucasheld.uptime_kuma.notification:
api_url: http://127.0.0.1:{{ uptime_kuma_port }} api_url: http://127.0.0.1:{{ uptime_kuma_port }}
api_token: "{{ uptime_kuma_api_token }}" api_token: "{{ uptime_kuma_api_token }}"
type: telegram type: telegram
name: "{{ kuma_tg_notif_name | default('Telegram alerts') }}" name: "{{ uptime_kuma_tg_notif_name | default('Telegram alerts') }}"
isDefault: "{{ kuma_tg_notif_is_default | default(true) }}" isDefault: "{{ uptime_kuma_tg_notif_is_default | default(true) }}"
applyExisting: "{{ kuma_tg_notif_apply_existing | default(true) }}" applyExisting: "{{ uptime_kuma_tg_notif_apply_existing | default(true) }}"
telegramBotToken: "{{ kuma_tg_bot_token }}" telegramBotToken: "{{ uptime_kuma_tg_bot_token }}"
telegramChatID: "{{ kuma_tg_chat_id }}" telegramChatID: "{{ uptime_kuma_tg_chat_id }}"
state: "present" state: "present"
- name: "Create monitor groups" - name: "Create monitor groups"
when: kuma_monitor_groups is defined when: uptime_kuma_monitor_groups is defined
loop: "{{ kuma_monitor_groups }}" loop: "{{ uptime_kuma_monitor_groups }}"
lucasheld.uptime_kuma.monitor: lucasheld.uptime_kuma.monitor:
api_url: http://127.0.0.1:{{ uptime_kuma_port }} api_url: http://127.0.0.1:{{ uptime_kuma_port }}
api_token: "{{ uptime_kuma_api_token }}" api_token: "{{ uptime_kuma_api_token }}"
@@ -46,7 +46,7 @@
name: "{{ item }}" name: "{{ item }}"
- name: "Create monitors" - name: "Create monitors"
loop: "{{ kuma_monitors }}" loop: "{{ uptime_kuma_monitors }}"
lucasheld.uptime_kuma.monitor: lucasheld.uptime_kuma.monitor:
api_url: http://127.0.0.1:{{ uptime_kuma_port }} api_url: http://127.0.0.1:{{ uptime_kuma_port }}
api_token: "{{ uptime_kuma_api_token }}" api_token: "{{ uptime_kuma_api_token }}"
@@ -60,7 +60,7 @@
description: "{{ item.description | default(omit) }}" description: "{{ item.description | default(omit) }}"
parent_name: "{{ item.parent_name | default(omit) }}" parent_name: "{{ item.parent_name | default(omit) }}"
notification_names: "{{ item.notification_names | default(uptime_kuma_default_notification_names) }}" notification_names: "{{ item.notification_names | default(uptime_kuma_default_notification_names) }}"
state: "{{ kuma_tg_notif_state | default('present') }}" state: "{{ uptime_kuma_tg_notif_state | default('present') }}"
ignoreTls: "{{ item.ignore_tls | default(false) }}" ignoreTls: "{{ item.ignore_tls | default(false) }}"
jsonPath: "{{ item.query | default(omit) }}" jsonPath: "{{ item.query | default(omit) }}"
expectedValue: "{{ item.expected_value | default(omit) }}" expectedValue: "{{ item.expected_value | default(omit) }}"