feat: add alertmanager and grafana
This commit is contained in:
parent
4816cce305
commit
f4680f2072
10 changed files with 428 additions and 11 deletions
|
|
@ -55,14 +55,51 @@
|
|||
# Prometheus runs with UID/GID 65534 inside the container
|
||||
- name: Podman Prometheus | PATCH | Install Prometheus configuration
|
||||
ansible.builtin.template:
|
||||
src: home/podman/prometheus.yml
|
||||
dest: "/home/{{ podman_prometheus_podman_rootless_user }}/prometheus.yml"
|
||||
src: "home/podman/{{ item }}"
|
||||
dest: "/home/{{ podman_prometheus_podman_rootless_user }}/{{ item }}"
|
||||
mode: "0400"
|
||||
owner: "{{ _podman_prometheus_user_subuid_start + 65533 }}"
|
||||
group: "{{ _podman_prometheus_user_subgid_start + 65533 }}"
|
||||
become: true
|
||||
with_items:
|
||||
- prometheus.yml
|
||||
notify:
|
||||
- Restart Prometheus
|
||||
|
||||
- name: Podman Prometheus | PATCH | Install Prometheus alert rules
|
||||
ansible.builtin.copy:
|
||||
src: "home/podman/{{ item }}"
|
||||
dest: "/home/{{ podman_prometheus_podman_rootless_user }}/{{ item }}"
|
||||
mode: "0400"
|
||||
owner: "{{ _podman_prometheus_user_subuid_start + 65533 }}"
|
||||
group: "{{ _podman_prometheus_user_subgid_start + 65533 }}"
|
||||
become: true
|
||||
with_items:
|
||||
- alert.rules.yml
|
||||
notify:
|
||||
- Restart Prometheus
|
||||
|
||||
# Alertmanager runs with UID/GID 65534 inside the container
|
||||
- name: Podman Prometheus | PATCH | Install Alertmanager configuration
|
||||
ansible.builtin.template:
|
||||
src: home/podman/alertmanager.yml
|
||||
dest: "/home/{{ podman_prometheus_podman_rootless_user }}/alertmanager.yml"
|
||||
mode: "0400"
|
||||
owner: "{{ _podman_prometheus_user_subuid_start + 65533 }}"
|
||||
group: "{{ _podman_prometheus_user_subgid_start + 65533 }}"
|
||||
become: true
|
||||
notify:
|
||||
- Restart Prometheus
|
||||
- Restart Alertmanager
|
||||
|
||||
# Grafana runs with UID/GID 472 inside the container
|
||||
- name: Podman Prometheus | PATCH | Create data directory for Grafana
|
||||
ansible.builtin.file:
|
||||
path: "/home/{{ podman_prometheus_podman_rootless_user }}/grafana-data"
|
||||
owner: "{{ _podman_prometheus_user_subuid_start + 471 }}"
|
||||
group: "{{ _podman_prometheus_user_subgid_start + 471 }}"
|
||||
mode: "0700"
|
||||
state: "directory"
|
||||
become: true
|
||||
|
||||
- name: Podman Prometheus | PATCH | Install container quadlets
|
||||
ansible.builtin.template:
|
||||
|
|
@ -71,9 +108,12 @@
|
|||
owner: "{{ podman_prometheus_podman_rootless_user }}"
|
||||
mode: "0400"
|
||||
with_items:
|
||||
- alertmanager.container
|
||||
- grafana.container
|
||||
- prometheus.container
|
||||
become: true
|
||||
notify:
|
||||
- Restart Grafana
|
||||
- Restart Prometheus
|
||||
|
||||
- name: Podman Prometheus | PATCH | Install network quadlets
|
||||
|
|
@ -84,8 +124,11 @@
|
|||
mode: "0400"
|
||||
with_items:
|
||||
- frontend.network
|
||||
- monitor.network
|
||||
become: true
|
||||
notify:
|
||||
- Restart Alertmanager
|
||||
- Restart Grafana
|
||||
- Restart Prometheus
|
||||
- Restart nginx
|
||||
|
||||
|
|
@ -122,7 +165,7 @@
|
|||
notify:
|
||||
- Restart nginx
|
||||
|
||||
- name: Podman Prometheus | PATCH | Make sure Prometheus and Nginx are running now and started on boot
|
||||
- name: Podman Prometheus | PATCH | Make sure Prometheus, Grafana and Nginx are running now and started on boot
|
||||
ansible.builtin.systemd_service:
|
||||
name: "{{ item }}.service"
|
||||
enabled: true
|
||||
|
|
@ -131,6 +174,8 @@
|
|||
daemon_reload: true
|
||||
scope: user
|
||||
with_items:
|
||||
- alertmanager
|
||||
- grafana
|
||||
- nginx
|
||||
- prometheus
|
||||
become: true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue