From 84ab4bb1a5b52a2dbe18eab8f5bfee5a2c9d2e57 Mon Sep 17 00:00:00 2001 From: Ozzy Date: Fri, 13 Sep 2024 11:41:03 +0100 Subject: [PATCH] Add pi setup --- playbooks/pis-setup.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 playbooks/pis-setup.yml 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