diff --git a/playbook.yml b/playbook.yml index 7386813..3e92210 100644 --- a/playbook.yml +++ b/playbook.yml @@ -75,6 +75,12 @@ - noc - pushgateway + - name: kuma + role: roles/kuma + tags: + - noc + - kuma + - name: mgmt role: roles/mgmt tags: mgmt diff --git a/roles/kuma/README-kuma.md b/roles/kuma/README-kuma.md new file mode 100644 index 0000000..13882c4 --- /dev/null +++ b/roles/kuma/README-kuma.md @@ -0,0 +1,20 @@ +# Kuma + +## About + +Uptime Kuma is an easy-to-use self-hosted monitoring tool, similar to uptime +robot but free and open source. + +## Install notes + +- https://github.com/louislam/uptime-kuma +- https://hub.docker.com/r/louislam/uptime-kuma + +```sh +docker run -d \ + --restart=always \ + -p 3001:3001 \ + -v uptime-kuma:/app/data \ + --name uptime-kuma \ + louislam/uptime-kuma:1 +``` diff --git a/roles/kuma/tasks/main.yml b/roles/kuma/tasks/main.yml new file mode 100644 index 0000000..6dad9ae --- /dev/null +++ b/roles/kuma/tasks/main.yml @@ -0,0 +1,32 @@ +--- + +- name: Create the Kuma volume + file: + path: "{{ data_path }}/kuma/data" + state: directory + +- name: Run Kuma + docker_container: + name: "{{ kuma_container_name }}" + image: "{{ kuma_image_qualified }}" + detach: yes + restart_policy: unless-stopped + recreate: >- + {{ + (kuma_config_files is defined and kuma_config_files is changed) + or + (kuma_templates is defined and kuma_templates is changed) + }} + network_mode: "{{ backend_network_name }}" + volumes: + - "{{ data_path }}/kuma/data:/app/data" + log_driver: json-file + log_options: + max-size: 50m + max-file: "3" + labels: + traefik.enable: "true" + traefik.http.routers.kuma.rule: "Host(`kuma.noc{{ dns_suffix }}.{{ frontend.domain }}`)" + traefik.http.routers.kuma.entrypoints: "websecure" + traefik.http.routers.kuma.tls.certresolver: "letsencrypt" + traefik.docker.network: "{{ backend_network_name }}" diff --git a/roles/kuma/vars/main.yml b/roles/kuma/vars/main.yml new file mode 100644 index 0000000..667e1ac --- /dev/null +++ b/roles/kuma/vars/main.yml @@ -0,0 +1,7 @@ +--- +# vars for Kuma +kuma_port: 3001 +kuma_container_name: "kuma" +kuma_image: "louislam/uptime-kuma" +kuma_version: "1" +kuma_image_qualified: "{{ kuma_image }}:{{ kuma_version }}"