ansible-role-postfix/tasks/postfix-letsencrypt-hook.yml

19 lines
736 B
YAML

---
- name: Manage the letsencrypt hook for postfix
block:
- name: Create the acme hooks directory if it does not exist
file: dest=/usr/lib/acme/hooks state=directory
- name: In the past we created a directory instead of a file. Check if it's the case
stat: path=/usr/lib/acme/hooks/postfix
register: postfix_hookdir
- name: Remove the wrong directory if it's present
file: dest=/usr/lib/acme/hooks/postfix state=absent
when: postfix_hookdir.stat.isdir is defined and postfix_hookdir.stat.isdir
- name: Install a hook for letsencrypt
template: src=postfix-letsencrypt-hook dest=/usr/lib/acme/hooks/postfix owner=root group=root mode=0555
tags: [ 'postfix', 'postfix_letsencrypt', 'letsencrypt' ]