2024-09-28 12:23:30 +02:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: Get local public IP
|
|
|
|
ansible.builtin.uri:
|
|
|
|
url: "https://ipinfo.io/ip"
|
|
|
|
return_content: true
|
|
|
|
register: local_public_ip
|
|
|
|
|
2024-11-01 16:42:54 +01:00
|
|
|
- name: Initiate spf_txt_records dict
|
2024-09-28 12:23:30 +02:00
|
|
|
ansible.builtin.set_fact:
|
2024-11-01 16:42:54 +01:00
|
|
|
spf_txt_records: {}
|
|
|
|
|
|
|
|
- name: Set SPF TXT records
|
|
|
|
loop: "{{ virtual_domains }}"
|
|
|
|
loop_control:
|
|
|
|
loop_var: domain
|
|
|
|
ansible.builtin.set_fact:
|
|
|
|
spf_txt_records: "{{ spf_txt_records | combine({domain: domain + '. IN TXT \"v=spf1 ip4:' + local_public_ip.content + ' mx ~all\"'}) }}"
|