34 lines
886 B
YAML
34 lines
886 B
YAML
- hosts: pis
|
|
become: yes
|
|
tasks:
|
|
- name: Update APT Cache
|
|
apt:
|
|
update_cache: yes
|
|
- name: Install python3 + pip3
|
|
apt:
|
|
pkg: ["python3", "python3-pip"]
|
|
|
|
- name: Install Uptime Kuma module
|
|
pip:
|
|
name: uptime-kuma-api
|
|
|
|
- name: Uptime Kuma login
|
|
lucasheld.uptime_kuma.login:
|
|
api_url: http://uptime.terra.lan
|
|
api_username: ozzy
|
|
api_password: 2UxVqjDDDQj23DQ
|
|
register: result
|
|
|
|
- name: Extract Uptime Kuma token
|
|
set_fact:
|
|
uptime_token: "{{ result.token }}"
|
|
|
|
- name: Create uptime monitor
|
|
lucasheld.uptime_kuma.monitor:
|
|
api_url: http://uptime.terra.lan
|
|
api_token: "{{ uptime_token }}"
|
|
hostname: "{{ inventory_hostname }}"
|
|
name: "{{ inventory_hostname_short }}"
|
|
type: ping
|
|
maxretries: 5
|
|
notification_names: ["Gotify"] |