Add role mailserver_spf

This commit is contained in:
Tunui Franken 2024-09-28 12:23:30 +02:00
parent 998390668e
commit 67e70e7017
2 changed files with 17 additions and 0 deletions

View file

@ -22,3 +22,5 @@
tags: rspamd
- role: mailserver_dkim
tags: dkim
- role: mailserver_spf
tags: spf

View file

@ -0,0 +1,15 @@
---
- name: Get local public IP
ansible.builtin.uri:
url: "https://ipinfo.io/ip"
return_content: true
register: local_public_ip
- name: Set SPF TXT record
ansible.builtin.set_fact:
spf_txt_record: "{{ virtual_domain }}. IN TXT \"v=spf1 ip4:{{ local_public_ip.content }} mx a ~all\""
- name: Print SPF TXT record for the DNS zone
ansible.builtin.debug:
msg: "Don't forget to add this to your DNS zone:\n{{ spf_txt_record }}"