Try to workaround the annoying issue where opendkim doesn't create a unix socket the first time.

This commit is contained in:
Brian Lee 2023-08-10 16:17:02 -07:00
parent 941c3f3645
commit c4bdc0164b
2 changed files with 18 additions and 3 deletions

View File

@ -25,12 +25,13 @@
See `man 5 postconf` for details. See `man 5 postconf` for details.
6. (optional) Create another TXT record for DKIM using the contents of /etc/dkimkeys/mail.txt 6. Sanity check: https://mxtoolbox.com/
7. (optional) Create another TXT record for DKIM using the contents of /etc/dkimkeys/mail.txt
* See [scripts/print-rdata.py](../scripts/print-rdata.py) for an example of how to parse mail.txt * See [scripts/print-rdata.py](../scripts/print-rdata.py) for an example of how to parse mail.txt
* See [octodns](https://github.com/octodns/octodns-easydns) and [dnscontrol](https://dnscontrol.org/) * See [octodns](https://github.com/octodns/octodns-easydns) and [dnscontrol](https://dnscontrol.org/)
7. Sanity check: https://mxtoolbox.com/
8. After records propogate, verify outbound mail using: https://www.mail-tester.com/ 8. (optional) After records propogate, verify outbound mail using: https://www.mail-tester.com/

View File

@ -27,9 +27,23 @@
creates: "/etc/dkimkeys/{{ dkim_selector }}.private" creates: "/etc/dkimkeys/{{ dkim_selector }}.private"
become: true become: true
become_user: opendkim become_user: opendkim
notify: restart opendkim
- name: Ensure postfix is in opendkim group - name: Ensure postfix is in opendkim group
ansible.builtin.user: ansible.builtin.user:
name: postfix name: postfix
groups: opendkim groups: opendkim
append: true append: true
notify: restart opendkim
- name: Register whether /var/spool/postfix/opendkim/opendkim.sock exists
ansible.builtin.stat:
path: /var/spool/postfix/opendkim/opendkim.sock
register: opendkim_socket
- name: (Workaround) Force opendkim to restart again if the unix socket is still missing.
ansible.builtin.systemd:
name: opendkim
state: restarted
when: not opendkim_socket.stat.exists