Skip to content

Commit b873bc9

Browse files
committed
Configure Prometheus in Ansible
1 parent 89b001a commit b873bc9

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

files/prometheus.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
3+
scrape_configs:
4+
- job_name: prometheus
5+
static_configs:
6+
- targets: ['localhost:9090']
7+
8+
- job_name: node
9+
static_configs:
10+
- targets: ['localhost:9100']
11+
12+
- job_name: caddy
13+
static_configs:
14+
- targets: ['localhost:2019']

matplotlib.org.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,28 @@
162162
enabled: true
163163
state: started
164164

165+
# Monitoring setup
166+
# ################
167+
- name: Configure Prometheus
168+
ansible.builtin.copy:
169+
src: prometheus.yml
170+
dest: /etc/prometheus/prometheus.yml
171+
mode: 0644
172+
notify:
173+
- Restart Prometheus
174+
175+
- name: Enable prometheus node exporter service
176+
ansible.builtin.systemd:
177+
name: prometheus-node-exporter.service
178+
enabled: true
179+
state: started
180+
181+
- name: Enable prometheus service
182+
ansible.builtin.systemd:
183+
name: prometheus.service
184+
enabled: true
185+
state: started
186+
165187
# Handlers restart/reload services at playbook completion
166188
# #######################################################
167189
handlers:
@@ -179,6 +201,11 @@
179201
name: caddy
180202
state: restarted
181203

204+
- name: Restart Prometheus
205+
ansible.builtin.systemd:
206+
name: prometheus
207+
state: restarted
208+
182209
- name: Restart webhook
183210
ansible.builtin.systemd:
184211
name: webhook

0 commit comments

Comments
 (0)