Closed mailuminatti closed 1 year ago
Unfortunately i can't reproduce this problem. It's working for me with the following playbook.
---
- hosts: localhost
connection: local
tasks:
- name: Add monitor 1
lucasheld.uptime_kuma.monitor:
api_url: http://127.0.0.1:3001
api_username: admin
api_password: secret123
type: http
name: monitor_1
url: http://127.0.0.1
state: present
- name: Add monitor 2
lucasheld.uptime_kuma.monitor:
api_url: http://127.0.0.1:3001
api_username: admin
api_password: secret123
type: http
name: monitor_2
url: http://127.0.0.2
state: present
- name: Add status page with monitor
lucasheld.uptime_kuma.status_page:
api_url: http://127.0.0.1:3001
api_username: admin
api_password: secret123
slug: page-status
title: 'Status Page'
publicGroupList:
- name: 'Page Status Monitors'
weight: 1
monitorList:
- name: monitor_1
- name: monitor_2
Hey @lucasheld, I did a bit more testing, and I can give you further details on how to reproduce this issue.
As you highlighted in the comment before, creating the status page with monitors works. However, where it fails is when a monitor is added. The expected result would be to ansible to mark this is a [changed]
, however it fails with the following error:
TASK [Add status page with monitor] ************************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Traceback (most recent call last):\n File \"/tmp/ansible_lucasheld.uptime_kuma.status_page_payload_kf4hahkj/ansible_lucasheld.uptime_kuma.status_page_payload.zip/ansible_collections/lucasheld/uptime_kuma/plugins/modules/status_page.py\", line 274, in main\n File \"/tmp/ansible_lucasheld.uptime_kuma.status_page_payload_kf4hahkj/ansible_lucasheld.uptime_kuma.status_page_payload.zip/ansible_collections/lucasheld/uptime_kuma/plugins/modules/status_page.py\", line 200, in run\n File \"/tmp/ansible_lucasheld.uptime_kuma.status_page_payload_kf4hahkj/ansible_lucasheld.uptime_kuma.status_page_payload.zip/ansible_collections/lucasheld/uptime_kuma/plugins/module_utils/common.py\", line 25, in object_changed\n if object_changed(value2[i], value[i]):\n File \"/tmp/ansible_lucasheld.uptime_kuma.status_page_payload_kf4hahkj/ansible_lucasheld.uptime_kuma.status_page_payload.zip/ansible_collections/lucasheld/uptime_kuma/plugins/module_utils/common.py\", line 25, in object_changed\n if object_changed(value2[i], value[i]):\nIndexError: list index out of range\n"}
To reproduce, simply create a new status page with one or two monitors, and add an additional one.
Thank you! It is a bug that has been fixed in version 0.6.1.
What happened: When creating a status page, multiple monitors can be added in the
monitorList
section. However, after executing the playbook, only the first monitor is added into the group in UptimeKumaExpected result: Multiple monitors to be created, after being added in the
monitorList
Sample code: