diff --git a/playbooks/pis-setup.yml b/playbooks/pis-setup.yml new file mode 100644 index 0000000..8bdd8f7 --- /dev/null +++ b/playbooks/pis-setup.yml @@ -0,0 +1,34 @@ +- 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"] \ No newline at end of file