Skip to content

Question/Help Wanted: Looping for Status Page #45

@tomasnorre

Description

@tomasnorre

Hi,

I might be misunderstanding something with ansible. But I would like to have my status page made a little simpler than manually adding a block for every service that I have added.

Current I have a vars.yml

monitor_http:
  - name: "Google"
    url: "https://google.com"
    ignoreTLS: false
  - name: "Service Internal"
    url: 'http://192.168.1.1/'
    ignoreTLS: true

in my tasks/main.yml i have

- name: Login by token and create a monitor
  lucasheld.uptime_kuma.monitor:
    api_url: "{{ kuma_api }}"
    api_token: "{{ api_token }}"
    name: "{{ item.name}}"
    type: http
    ignoreTls: "{{ item.ignoreTLS }}"
    url: "{{ item.url }}"
    state: present
  with_items: "{{ monitor_http }}"

Which correctly creates a monitoring per entry in vars.yml.
But when I try to do the same for my status page, it doesn't work, it adds the last entry on the vars.yml

- name: Add status page
  lucasheld.uptime_kuma.status_page:
    api_url: "{{ kuma_api }}"
    api_token: "{{ api_token }}"
    slug: default
    title: default
    state: present
    publicGroupList:
      - name: "{{ item.name }}"
        weight: 1
        monitorList:
          - name: "{{ item.name }}"
  with_items: "{{ monitor_http }}"

I have tried to move the with_items to have it in PublicGroupList and MonitorList, neither worked. Any input here on how to solve this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions