diff --git a/README.md b/README.md index 10688e9..99541f5 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/ansible/05-vpn.yml b/ansible/05-vpn.yml index 721d4af..82190e7 100644 --- a/ansible/05-vpn.yml +++ b/ansible/05-vpn.yml @@ -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 diff --git a/ansible/06-prometheus-exporters.yml b/ansible/06-prometheus-exporters.yml new file mode 100644 index 0000000..e2d7b9d --- /dev/null +++ b/ansible/06-prometheus-exporters.yml @@ -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