Fix the creation of the letsencrypt hook for postfix.

This commit is contained in:
Andrea Dell'Amico 2020-02-07 16:30:21 +01:00
parent 94ffed10c9
commit e433a4eeb3
3 changed files with 22 additions and 8 deletions

View File

@ -1,4 +1,8 @@
---
- name: Create the acme hooks directory if it does not exist
file: dest=/usr/lib/acme/hooks state=directory
tags: [ 'postfix', 'postfix-relay', 'postfix_letsencrypt', 'letsencrypt' ]
- name: Install a hook for letsencrypt
template: src=postfix-letsencrypt-hook dest=/usr/lib/acme/hooks/postfix owner=root group=root mode=4555
tags: [ 'postfix', 'postfix-relay' ]
tags: [ 'postfix', 'postfix-relay', 'postfix_letsencrypt', 'letsencrypt' ]

View File

@ -1,8 +1,18 @@
---
- 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/postfix state=directory
tags: [ 'postfix', 'postfix-relay', 'letsencrypt' ]
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=4555
tags: [ 'postfix', 'postfix-relay', 'letsencrypt' ]
template: src=postfix-letsencrypt-hook dest=/usr/lib/acme/hooks/postfix owner=root group=root mode=0555
tags: [ 'postfix', 'postfix_letsencrypt', 'letsencrypt' ]

View File

@ -1,7 +1,7 @@
---
- name: Write sasl hash file
template: src=sasl_passwd.j2 dest=/etc/postfix/sasl_passwd owner=root group=root mode=0400
when: postfix_use_sasl_auth
when: postfix_use_sasl_auth | bool
register: update_sasl_hash
tags: postfix-relay