vm-ansible/roles/smtpgateway/tasks/main.yaml

64 lines
1.2 KiB
YAML
Raw Normal View History

---
- name: "Install Postfix via apt"
2023-08-30 23:13:59 +02:00
apt:
update_cache: yes
state: present
name:
- postfix
- name: Install Postfix mail gateway config
2023-08-30 23:13:59 +02:00
template:
src: templates/main.cf
dest: /etc/postfix/main.cf
2022-02-05 21:35:28 +01:00
- name: Build /etc/mailname
2023-08-30 23:13:59 +02:00
shell:
2023-07-25 17:03:48 +02:00
cmd: "hostname --fqdn > /etc/mailname"
2022-02-05 21:35:28 +01:00
- name: Restart Postfix
2023-08-30 23:13:59 +02:00
service:
name: postfix
state: restarted
enabled: yes
2022-02-05 20:00:55 +01:00
- name: Allow smtp port via ufw
community.general.ufw:
rule: allow
2022-04-16 19:09:47 +02:00
port: smtp
2022-05-29 20:38:38 +02:00
src: 192.168.69.0/24
2022-05-29 15:15:02 +02:00
- name: "Install postfix exporter"
2023-08-30 23:13:59 +02:00
apt:
2022-05-29 15:15:02 +02:00
update_cache: yes
state: present
name:
- prometheus-postfix-exporter
- name: Copy exporter config
2023-08-30 23:13:59 +02:00
copy:
2022-05-29 21:32:09 +02:00
src: prometheus-postfix-exporter
dest: /etc/default/prometheus-postfix-exporter
owner: root
group: root
mode: '0644'
- name: Add the prometheus user to postdrop group
2023-08-30 23:13:59 +02:00
user:
name: prometheus
groups: postdrop
append: yes
2022-05-29 15:24:02 +02:00
- name: Enable and restart exporter daemon
2023-08-30 23:13:59 +02:00
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
...