Write report to a local file instead of printing the DNS records

This commit is contained in:
Tunui Franken 2024-09-29 11:47:35 +02:00
parent 094e42118d
commit d9d0f35034

View file

@ -17,16 +17,27 @@
with_items: "{{ dkim_dir.files }}"
register: dkim_txt_record_slurp
- name: Print DKIM TXT record for the DNS zone
ansible.builtin.debug:
msg: "Don't forget to add this to your DNS zone:\n{{ item.content | b64decode }}"
- name: Define DNS record content
ansible.builtin.set_fact:
dns_record_text: "DNS RECORDS NEEDED FOR MAILSERVER\n"
- name: Set DKIM TXT record for the DNS record file
ansible.builtin.set_fact:
dns_record_text: "{{ dns_record_text }}\n{{ item.content | b64decode }}"
with_items:
- "{{ dkim_txt_record_slurp.results }}"
- 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 }}"
- name: Set SPF TXT record for the DNS record file
ansible.builtin.set_fact:
dns_record_text: "{{ dns_record_text }}\n{{ spf_txt_record }}"
- name: Print DMARC TXT record for the DNS zone
ansible.builtin.debug:
msg: "Don't forget to add this to your DNS zone:\n{{ dmarc_txt_record }}"
- name: Set DMARC TXT record for the DNS record file
ansible.builtin.set_fact:
dns_record_text: "{{ dns_record_text }}\n{{ dmarc_txt_record }}"
- name: Write DNS records to a local '/tmp/mailserver_dns_records.txt' file
ansible.builtin.copy:
content: "{{ dns_record_text }}"
dest: /tmp/mailserver_dns_records.txt
mode: "644"
delegate_to: localhost