Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question/Help Wanted: Looping for Status Page #45

Open
tomasnorre opened this issue Jan 24, 2024 · 0 comments
Open

Question/Help Wanted: Looping for Status Page #45

tomasnorre opened this issue Jan 24, 2024 · 0 comments

Comments

@tomasnorre
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant