summaryrefslogtreecommitdiffstats
path: root/roles/IMAP/tasks
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2014-06-28 23:21:51 +0200
committerGuilhem Moulin <guilhem@fripost.org>2015-06-07 02:52:06 +0200
commitebab80fc4e8e1999833f9295649766133eb4d6fa (patch)
tree910023d4e5b5c1ddadb7792cdad0b693736c3238 /roles/IMAP/tasks
parent9692d409658ce552ab3e0d9f41aadca1c7bcb407 (diff)
Generate certs for Dovecot and Nginx if they are not there.
Diffstat (limited to 'roles/IMAP/tasks')
-rw-r--r--roles/IMAP/tasks/imap.yml16
1 files changed, 14 insertions, 2 deletions
diff --git a/roles/IMAP/tasks/imap.yml b/roles/IMAP/tasks/imap.yml
index 6191a50..c9471f3 100644
--- a/roles/IMAP/tasks/imap.yml
+++ b/roles/IMAP/tasks/imap.yml
@@ -62,12 +62,24 @@
owner=vmail group=vmail
mode=0700
+- name: Generate a private key and a X.509 certificate for Dovecot
+ command: genkeypair.sh x509
+ --pubkey=/etc/dovecot/ssl/imap.fripost.org.pem
+ --privkey=/etc/dovecot/ssl/imap.fripost.org.key
+ --dns imap.fripost.org
+ -t rsa -b 4096 -h sha512
+ register: r1
+ changed_when: r1.rc == 0
+ failed_when: r1.rc > 1
+ notify:
+ - Restart Dovecot
+
- name: Configure Dovecot
copy: src=etc/dovecot/{{ item }}
dest=/etc/dovecot/{{ item }}
owner=root group=root
mode=0644
- register: r
+ register: r2
with_items:
- conf.d/10-auth.conf
- conf.d/10-logging.conf
@@ -87,6 +99,6 @@
- name: Start Dovecot
service: name=dovecot state=started
- when: not r.changed
+ when: not (r1.changed or r2.changed)
- meta: flush_handlers