64 lines
1.3 KiB
YAML
64 lines
1.3 KiB
YAML
---
|
|
- name: "Install Postfix via apt"
|
|
ansible.builtin.apt:
|
|
update_cache: yes
|
|
state: present
|
|
name:
|
|
- postfix
|
|
|
|
- name: Install Postfix mail gateway config
|
|
ansible.builtin.template:
|
|
src: templates/main.cf
|
|
dest: /etc/postfix/main.cf
|
|
|
|
- name: Build /etc/mailname
|
|
ansible.builtin.shell:
|
|
cmd: "hostname --fqdn > /etc/mailname"
|
|
|
|
- name: Restart Postfix
|
|
ansible.builtin.service:
|
|
name: postfix
|
|
state: restarted
|
|
enabled: yes
|
|
|
|
- name: Allow smtp port via ufw
|
|
community.general.ufw:
|
|
rule: allow
|
|
port: smtp
|
|
src: 192.168.69.0/24
|
|
|
|
- name: "Install postfix exporter"
|
|
ansible.builtin.apt:
|
|
update_cache: yes
|
|
state: present
|
|
name:
|
|
- prometheus-postfix-exporter
|
|
|
|
- name: Copy exporter config
|
|
ansible.builtin.copy:
|
|
src: prometheus-postfix-exporter
|
|
dest: /etc/default/prometheus-postfix-exporter
|
|
owner: root
|
|
group: root
|
|
mode: '0644'
|
|
|
|
- name: Add the prometheus user to postdrop group
|
|
ansible.builtin.user:
|
|
name: prometheus
|
|
groups: postdrop
|
|
append: yes
|
|
|
|
- name: Enable and restart exporter daemon
|
|
ansible.builtin.service:
|
|
name: prometheus-postfix-exporter
|
|
state: restarted
|
|
enabled: yes
|
|
|
|
- name: Allow postfix exporter via ufw
|
|
community.general.ufw:
|
|
rule: allow
|
|
port: "9154"
|
|
proto: tcp
|
|
src: 192.168.69.0/24
|
|
...
|