2022-01-01 19:24:52 +01:00
|
|
|
---
|
|
|
|
- name: "Install Postfix via apt"
|
2023-03-05 19:00:38 +01:00
|
|
|
ansible.builtin.apt:
|
2022-01-01 19:24:52 +01:00
|
|
|
update_cache: yes
|
|
|
|
state: present
|
|
|
|
name:
|
|
|
|
- postfix
|
|
|
|
|
|
|
|
- name: Install Postfix forwarder config
|
2023-03-05 19:00:38 +01:00
|
|
|
ansible.builtin.template:
|
2022-01-01 19:24:52 +01:00
|
|
|
src: templates/main.cf
|
|
|
|
dest: /etc/postfix/main.cf
|
|
|
|
|
|
|
|
- name: Restart Postfix
|
2023-03-05 19:00:38 +01:00
|
|
|
ansible.builtin.service:
|
2022-01-01 19:24:52 +01:00
|
|
|
name: postfix
|
|
|
|
state: restarted
|
|
|
|
enabled: yes
|
2022-05-29 15:15:02 +02:00
|
|
|
|
|
|
|
- name: "Install postfix exporter"
|
2023-03-05 19:00:38 +01:00
|
|
|
ansible.builtin.apt:
|
2022-05-29 15:15:02 +02:00
|
|
|
update_cache: yes
|
|
|
|
state: present
|
|
|
|
name:
|
|
|
|
- prometheus-postfix-exporter
|
|
|
|
|
2022-11-30 09:58:36 +01:00
|
|
|
- name: Copy postfix exporter config
|
2022-05-29 21:32:09 +02:00
|
|
|
ansible.builtin.copy:
|
|
|
|
src: prometheus-postfix-exporter
|
|
|
|
dest: /etc/default/prometheus-postfix-exporter
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: '0644'
|
|
|
|
|
2022-11-30 09:58:36 +01:00
|
|
|
- name: Add the prometheus user to postdrop group
|
|
|
|
ansible.builtin.user:
|
|
|
|
name: prometheus
|
|
|
|
groups: postdrop
|
|
|
|
append: yes
|
|
|
|
|
2022-05-29 15:24:02 +02:00
|
|
|
- name: Enable and restart exporter daemon
|
2023-03-05 19:00:38 +01:00
|
|
|
ansible.builtin.service:
|
2022-05-29 15:24:02 +02:00
|
|
|
name: prometheus-postfix-exporter
|
|
|
|
state: restarted
|
|
|
|
enabled: yes
|
|
|
|
|
2022-05-29 15:15:02 +02:00
|
|
|
- name: Allow postfix exporter via ufw
|
|
|
|
community.general.ufw:
|
|
|
|
rule: allow
|
2022-05-29 21:28:56 +02:00
|
|
|
port: "9154"
|
2022-05-29 15:15:02 +02:00
|
|
|
proto: tcp
|
|
|
|
src: 192.168.69.0/24
|
2022-04-16 19:55:29 +02:00
|
|
|
...
|