Add the monitoring stack
This commit is contained in:
1 parent
5e0a27b32b
commit
924f000e17
14 files changed
+376
No files matched your search
@@ -0,0 +1,26 @@
|
||||
---
|
||||
# Tasks for cAdvisor (Container Advisor) role
|
||||
- name: Pull Container Advisor image
|
||||
docker_image:
|
||||
name: "{{ cadvisor_image }}"
|
||||
source: pull
|
||||
force_source: yes
|
||||
|
||||
- name: Create Container Advisor container
|
||||
docker_container:
|
||||
name: "{{ cadvisor_container }}"
|
||||
image: "{{ cadvisor_image }}"
|
||||
state: started
|
||||
restart_policy: "unless-stopped"
|
||||
env:
|
||||
TZ: "Asia/Kolkata"
|
||||
published_ports:
|
||||
- "127.0.0.1:{{ cadvisor_port }}:8080"
|
||||
volumes:
|
||||
- /:/rootfs:ro
|
||||
- /var/run:/var/run:ro
|
||||
- /sys:/sys:ro
|
||||
- /var/lib/docker/:/var/lib/docker:ro
|
||||
privileged: yes
|
||||
devices:
|
||||
- "/dev/kmsg"
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
# Default variables for Grafana role
|
||||
grafana_user: "{{ ansible_user }}"
|
||||
grafana_image: "grafana/grafana:latest"
|
||||
grafana_directory: "/opt/grafana"
|
||||
grafana_container: "grafana"
|
||||
@@ -0,0 +1,42 @@
|
||||
---
|
||||
# Tasks for Grafana role
|
||||
- name: Look up the Grafana user
|
||||
getent:
|
||||
database: passwd
|
||||
key: "{{ grafana_user }}"
|
||||
split: ":"
|
||||
|
||||
- name: Pull Grafana image
|
||||
docker_image:
|
||||
name: "{{ grafana_image }}"
|
||||
source: pull
|
||||
force_source: yes
|
||||
|
||||
- name: Ensure Grafana Directory exists
|
||||
file:
|
||||
path: "{{ grafana_directory }}"
|
||||
state: directory
|
||||
group: "{{ grafana_user }}"
|
||||
owner: "{{ grafana_user }}"
|
||||
mode: 0755
|
||||
|
||||
- name: Create Grafana container
|
||||
docker_container:
|
||||
name: "{{ grafana_container }}"
|
||||
image: "{{ grafana_image }}"
|
||||
state: started
|
||||
restart_policy: "unless-stopped"
|
||||
user: "{{ getent_passwd[grafana_user][1] }}:{{ getent_passwd[grafana_user][2] }}"
|
||||
env:
|
||||
GF_SERVER_ROOT_URL: "https://{{ http_host }}"
|
||||
GF_INSTALL_PLUGINS: "grafana-clock-panel, grafana-simple-json-datasource, natel-discrete-panel, briangann-gauge-panel, vonage-status-panel, neocat-cal-heatmap-panel, natel-plotly-panel"
|
||||
GF_AUTH_ANONYMOUS_ENABLED: "true"
|
||||
GF_AUTH_ANONYMOUS_ORG_NAME: "Public"
|
||||
GF_AUTH_ANONYMOUS_ORG_ROLE: "Viewer"
|
||||
GF_AUTH_ANONYMOUS_HIDE_VERSION: "true"
|
||||
links:
|
||||
- "{{ influx_container }}:influx"
|
||||
published_ports:
|
||||
- 127.0.0.1:3005:3000
|
||||
volumes:
|
||||
- "{{ grafana_directory }}:/var/lib/grafana"
|
||||
@@ -0,0 +1,48 @@
|
||||
---
|
||||
# The image is configured to run by default as user loki with UID 10001 and GID 10001.
|
||||
# You can use a different user, specially if you are using bind mounts, by specifying
|
||||
# the UID with a docker run command and using --user=UID with a numeric UID suited to your needs.
|
||||
|
||||
# Tasks for Loki role
|
||||
- name: Pull Loki image
|
||||
docker_image:
|
||||
name: "{{ loki_image }}"
|
||||
source: pull
|
||||
force_source: yes
|
||||
|
||||
- name: Ensure Loki Directory exists
|
||||
file:
|
||||
path: "{{ loki_directory }}"
|
||||
state: directory
|
||||
group: "{{ loki_user }}"
|
||||
owner: "{{ loki_user }}"
|
||||
mode: 0755
|
||||
|
||||
# - name: Ensure Loki Config Directory exists
|
||||
# file:
|
||||
# path: "{{ loki_directory }}/config"
|
||||
# state: directory
|
||||
# group: "{{ loki_user }}"
|
||||
# owner: "{{ loki_user }}"
|
||||
# mode: 0755
|
||||
|
||||
- name: Copy the Loki conf file
|
||||
template:
|
||||
src: "files/loki-config.yaml"
|
||||
dest: "{{ loki_directory }}/loki-config.yaml"
|
||||
group: "{{ loki_user }}"
|
||||
owner: "{{ loki_user }}"
|
||||
mode: 0644
|
||||
|
||||
- name: Create Loki container
|
||||
docker_container:
|
||||
name: "{{ loki_container }}"
|
||||
image: "{{ loki_image }}"
|
||||
state: started
|
||||
restart_policy: "unless-stopped"
|
||||
published_ports:
|
||||
- "127.0.0.1:{{ loki_port }}:3100"
|
||||
volumes:
|
||||
- "{{ loki_directory }}:/mnt/config"
|
||||
command:
|
||||
- "-config.file=/mnt/config/loki-config.yaml"
|
||||
@@ -0,0 +1,25 @@
|
||||
---
|
||||
# Tasks for Node exporter role
|
||||
- name: Pull Node exporter image
|
||||
docker_image:
|
||||
name: "{{ node_exporter_image }}"
|
||||
source: pull
|
||||
force_source: yes
|
||||
|
||||
- name: Create Node exporter container
|
||||
docker_container:
|
||||
name: "{{ node_exporter_container }}"
|
||||
image: "{{ node_exporter_image }}"
|
||||
state: started
|
||||
restart_policy: "unless-stopped"
|
||||
published_ports:
|
||||
- "127.0.0.1:{{ node_exporter_port }}:9100"
|
||||
volumes:
|
||||
- /proc:/host/proc:ro
|
||||
- /sys:/host/sys:ro
|
||||
- /:/rootfs:ro,rslave
|
||||
command:
|
||||
- '--path.procfs=/host/proc'
|
||||
- '--path.rootfs=/rootfs'
|
||||
- '--path.sysfs=/host/sys'
|
||||
- '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)'
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
# Default variables for Mosquitto role
|
||||
mosquitto_user: "{{ ansible_user }}"
|
||||
mosquitto_image: "mosquitto:latest"
|
||||
mosquitto_directory: "/opt/mosquitto"
|
||||
mosquitto_container: "mosquitto"
|
||||
@@ -0,0 +1,44 @@
|
||||
---
|
||||
# The image is configured to run by default as user promtail with UID 10001 and GID 10001.
|
||||
# You can use a different user, specially if you are using bind mounts, by specifying
|
||||
# the UID with a docker run command and using --user=UID with a numeric UID suited to your needs.
|
||||
|
||||
# Tasks for Promtail role
|
||||
- name: Pull Promtail image
|
||||
docker_image:
|
||||
name: "{{ promtail_image }}"
|
||||
source: pull
|
||||
force_source: yes
|
||||
|
||||
- name: Ensure Promtail Directory exists
|
||||
file:
|
||||
path: "{{ promtail_directory }}"
|
||||
state: directory
|
||||
group: "{{ promtail_user }}"
|
||||
owner: "{{ promtail_user }}"
|
||||
mode: 0755
|
||||
|
||||
- name: Copy the Promtail conf file
|
||||
template:
|
||||
src: "files/promtail-config.yaml"
|
||||
dest: "{{ promtail_directory }}/promtail-config.yaml"
|
||||
group: "{{ promtail_user }}"
|
||||
owner: "{{ promtail_user }}"
|
||||
mode: 0644
|
||||
|
||||
- name: Create Promtail container
|
||||
docker_container:
|
||||
name: "{{ promtail_container }}"
|
||||
image: "{{ promtail_image }}"
|
||||
state: started
|
||||
restart_policy: "unless-stopped"
|
||||
links:
|
||||
- "{{ loki_container }}:loki"
|
||||
volumes:
|
||||
- "{{ promtail_directory }}:/mnt/config"
|
||||
- "/var/log:/var/log:ro"
|
||||
- "/var/lib/docker/containers:/var/lib/docker/containers:ro"
|
||||
# published_ports:
|
||||
# - "127.0.0.1:{{ promtail_port }}:9080"
|
||||
command:
|
||||
- "-config.file=/mnt/config/promtail-config.yaml"
|
||||
Reference in new issue
Block a user