Browse Source

properly install changed SSL certificate

Dan Milon 9 years ago
parent
commit
a5c6f663ce
1 changed files with 9 additions and 2 deletions
  1. 9
    2
      roles/common/tasks/ssl.yml

+ 9
- 2
roles/common/tasks/ssl.yml View File

@@ -1,15 +1,19 @@
1 1
 - name: Copy SSL private key into place
2 2
   copy: src=wildcard_private.key dest=/etc/ssl/private/wildcard_private.key group=ssl-cert owner=root mode=640
3
+  register: private_key
3 4
 
4 5
 - name: Copy SSL public certificate into place
5 6
   copy: src=wildcard_public_cert.crt dest=/etc/ssl/certs/wildcard_public_cert.crt group=root owner=root mode=644
7
+  register: certificate
6 8
 
7 9
 - name: Copy CA combined certificate into place
8 10
   copy: src=wildcard_ca.pem dest=/etc/ssl/certs/wildcard_ca.pem group=root owner=root mode=644
11
+  register: ca_certificate
9 12
 
10 13
 - name: Create a combined version of the public cert with intermediate and root CAs
11 14
   shell: cat /etc/ssl/certs/wildcard_public_cert.crt /etc/ssl/certs/wildcard_ca.pem >
12
-    /etc/ssl/certs/wildcard_combined.pem creates=/etc/ssl/certs/wildcard_combined.pem
15
+    /etc/ssl/certs/wildcard_combined.pem
16
+  when: private_key.changed or certificate.changed or ca_certificate.changed
13 17
 
14 18
 - name: Set permissions on combined public cert
15 19
   file: name=/etc/ssl/certs/wildcard_combined.pem mode=644
@@ -22,7 +26,10 @@
22 26
   command: a2enmod ssl creates=/etc/apache2/mods-enabled/ssl.load
23 27
 
24 28
 - name: Enable NameVirtualHost for HTTPS
25
-  lineinfile: dest=/etc/apache2/ports.conf regexp='^    NameVirtualHost \*:443' insertafter='^<IfModule mod_ssl.c>' line='    NameVirtualHost *:443'
29
+  lineinfile:
30
+    dest=/etc/apache2/ports.conf regexp='^    NameVirtualHost \*:443'
31
+    insertafter='^<IfModule mod_ssl.c>'
32
+    line='    NameVirtualHost *:443'
26 33
 
27 34
 - name: Enable Apache SOCACHE_SHMCB module for the SSL stapling cache
28 35
   command: a2enmod socache_shmcb

Loading…
Cancel
Save