ansible-uptime-kuma
ansible-uptime-kuma copied to clipboard
ansible role for installation and configuration
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?
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?
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 }}"