Configure prometheus node-exporter

This commit is contained in:
Pijus Kamandulis 2024-05-30 00:52:52 +03:00
parent 16efa8acfe
commit 311d6ce925
3 changed files with 24 additions and 1 deletions

View File

@ -70,6 +70,7 @@ mx1_fw:
- name: wg0
allowed_tcp:
- 22 # SSH
- 9100 # Prometheus node exporter
mx2_fw:
interfaces:
- name: vio0
@ -83,6 +84,7 @@ mx2_fw:
- name: wg0
allowed_tcp:
- 22 # SSH
- 9100 # Prometheus node exporter
```
The hosts are taken from the `inventory.yml` file:
@ -132,3 +134,4 @@ Current ansible playbooks:
- 03-mail.yml - installs and configures dovecot and opensmtpd
- 04-secondary-mail.yml - installs and configures opensmtpd as a backup mail receiver
- 05-vpn.yml - configures wireguard vpn
- 06-prometheus-exporters.yml - installs prometheus exporters

View File

@ -24,6 +24,7 @@
owner: root
group: wheel
mode: "0600"
register: wg_config
- name: Create wireguard interface
template:
@ -33,4 +34,4 @@
- name: Apply network configuration if changed
shell: sh /etc/netstart {{ lookup('vars', inventory_hostname + '_wg').interface }}
when: iface_config.changed
when: wg_config.changed or iface_config.changed

View File

@ -0,0 +1,19 @@
- name: VPN Setup
hosts:
- mx1
- mx2
remote_user: root
vars_files:
- vars.yml
tasks:
- name: Install node-exporter
community.general.openbsd_pkg:
name:
- node_exporter
state: present
- name: Enable and start node_exporter
service:
name: node_exporter
enabled: yes
state: started