A roles/containers/uptime-kuma/README.org => roles/containers/uptime-kuma/README.org +11 -0
@@ 0,0 1,11 @@
+* /roles/containers/uptime-kuma
+[[https://github.com/louislam/uptime-kuma][Uptime Kuma]] module.
+
+Before using this,
+you probably want to set/edit the following variables
+in your ~secret.yml~ (or your unencrypted config):
+#+begin_src yaml
+uptime_kuma_project_dir: "status"
+uptime_kuma_port: 3001
+uptime_kuma_domain: "status.ccw.icu"
+#+end_src
A roles/containers/uptime-kuma/defaults/main.yml => roles/containers/uptime-kuma/defaults/main.yml +4 -0
@@ 0,0 1,4 @@
+---
+uptime_kuma_project_dir: "status"
+uptime_kuma_port: 3001
+uptime_kuma_domain: "status.ccw.icu"
A roles/containers/uptime-kuma/tasks/caddy.yml => roles/containers/uptime-kuma/tasks/caddy.yml +27 -0
@@ 0,0 1,27 @@
+---
+- name: Make sure uptime-kuma-caddy reverse proxy config exists
+ become: true
+ vars:
+ domain: "{{ uptime_kuma_domain }}"
+ port: "{{ uptime_kuma_port }}"
+ template:
+ src: ../../../network/caddy/templates/reverse-proxy.template
+ dest: /etc/caddy/uptime-kuma
+ validate: caddy validate --adapter caddyfile --config %s
+ register: projectconfig
+
+- name: Make sure caddy links to the uptime-kuma config
+ become: true
+ lineinfile:
+ path: /etc/caddy/Caddyfile
+ search_string: "^import /etc/caddy/uptime-kuma"
+ line: "import /etc/caddy/uptime-kuma"
+ validate: caddy validate --adapter caddyfile --config %s
+ register: caddyconfig
+
+- name: Restart caddy
+ become: true
+ service:
+ name: caddy
+ state: restarted
+ when: projectconfig.changed or caddyconfig.changed
A roles/containers/uptime-kuma/tasks/main.yml => roles/containers/uptime-kuma/tasks/main.yml +3 -0
@@ 0,0 1,3 @@
+---
+- include_tasks: setup.yml
+- include_tasks: caddy.yml
A roles/containers/uptime-kuma/tasks/setup.yml => roles/containers/uptime-kuma/tasks/setup.yml +19 -0
@@ 0,0 1,19 @@
+---
+- name: Ensure woodpecker-project-dir "{{ uptime_kuma_project_dir }}" exists
+ file:
+ path: "{{ container_dir }}/{{ uptime_kuma_project_dir }}"
+ state: directory
+ recurse: true
+
+- name: Setup uptime-kuma
+ docker_container:
+ name: uptime-kuma
+ restart_policy: unless-stopped
+ image: louislam/uptime-kuma:1.22.1-alpine
+ volumes:
+ - "{{ container_dir }}\
+ /{{ uptime_kuma_project_dir }}\
+ /uptime-kuma-data\
+ :/app/data"
+ ports:
+ - "{{ uptime_kuma_port }}:3001"
M run.yml => run.yml +5 -0
@@ 32,3 32,8 @@
roles:
- role: containers/calckey
tags: calckey
+- name: setup Uptime Kuma
+ hosts: all
+ roles:
+ - role: containers/uptime-kuma
+ tags: status