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

ansible role for installation and configuration #14

Open
beechesII opened this issue Jan 28, 2023 · 2 comments
Open

ansible role for installation and configuration #14

beechesII opened this issue Jan 28, 2023 · 2 comments

Comments

@beechesII
Copy link
Contributor

Dear @lucasheld ,

at the moment I work on a ansible role that installs uptime-kuma with docker-compose. After the installation the role configures the uptime-kuma instance with your amazing modules.

I want to add the role to your collection.

Do you agree?

@lucasheld
Copy link
Owner

What do you mean by configuration after the installation? Which steps should be performed there?

Is this a common practice to distribute such roles in a collection?

@beechesII
Copy link
Contributor Author

Distribute roles in collections is a best practice, see here.

Which steps should be performed there?

At the moment a user using this collection need to write a big playbook to configure the uptime-kuma instance with your modules.

My role compress this big playbook. For example the user only need to define a variable with http monitors and the role task will loop them:

# variable definition
uptime_kuma_http_monitor:
    - name: Frontend - example.com
      url: example.com
      notification_names:
        - "My Alerts"

    - name: Frontend - dev.example.com
      url: dev.example.com
      notification_names:
        - "My Alerts"

# task in role:
- name: Manage http monitor
  when: uptime_kuma_http_monitor is defined
  lucasheld.uptime_kuma.monitor:
    api_url: "{{ uptime_kuma_api_url }}"
    api_token: "{{ uptime_kuma_api_token }}"
    type: http
    name: "{{ item.name }}"
    url: "{{ item.url }}"
    interval: "{{ item.interval | default('60') }}"
    maxretries: "{{ item.maxretries | default('5') }}"
    retryInterval: "{{ item.retryInterval | default('60') }}"
    resendInterval: "{{ item.resendInterval | default('0') }}"
    expiryNotification: "{{ item.expiryNotification | default(true) }}"
    ignoreTls: "{{ item.ignoreTls | default(false) }}"
    upsideDown: "{{ item.upsideDown | default(omit) }}"
    maxredirects: "{{ item.maxredirects | default('10') }}"
    accepted_statuscodes: "{{ item.accepted_statuscodes | default(['200-299']) }}"
    notification_names: "{{ item.notification_names | default(omit) }}"
    proxy: "{{ item.proxy | default(omit) }}"
    method: "{{ item.method | default('GET') }}"
    body: "{{ item.body | default(omit) }}"
    headers: "{{ item.headers | default(omit) }}"
    authMethod: "{{ item.authMethod | default(omit) }}"
    basic_auth_user: "{{ item.basic_auth_user | default(omit) }}"
    basic_auth_pass: "{{ item.basic_auth_pass | default(omit) }}"
    state: "{{ item.state | default('present') }}"
  loop: "{{ uptime_kuma_http_monitor }}"

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

2 participants