Skip to content

Commit

Permalink
certificates role: restart nginx after update
Browse files Browse the repository at this point in the history
Adapt certificates role to restart nginx after replacing certificates
so that they get reloaded.
  • Loading branch information
stsnel committed Nov 20, 2024
1 parent df1e294 commit 69a5ff2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
Binary file added roles/certificates/handlers/.main.yml.swp
Binary file not shown.
7 changes: 7 additions & 0 deletions roles/certificates/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
# copyright Utrecht University

- name: Restart Nginx webserver
ansible.builtin.service:
name: nginx
state: restarted
10 changes: 10 additions & 0 deletions roles/certificates/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
force: false
state: present
when: cert_mode == "selfsigned"
notify: Restart Nginx webserver


- name: Upload private key of certificate
Expand All @@ -33,6 +34,7 @@
group: root
mode: '0600'
when: cert_mode == "static"
notify: Restart Nginx webserver


- name: Create file with certificate and chain
Expand All @@ -43,6 +45,7 @@
group: root
mode: "0644"
when: cert_mode == "static"
notify: Restart Nginx webserver


- name: Ensure OpenSSL certificate signing request is present
Expand All @@ -68,6 +71,7 @@
chdir: '{{ openssl_certs_dir }}'
creates: '{{ openssl_crt_selfsigned }}'
when: cert_mode == "selfsigned"
notify: Restart Nginx webserver


- name: Ensure signed private key is present
Expand All @@ -77,6 +81,7 @@
args:
creates: '{{ openssl_private_dir }}/{{ openssl_key_signed }}'
when: cert_mode == "selfsigned"
notify: Restart Nginx webserver


- name: Ensure signed certificate is present
Expand All @@ -86,6 +91,7 @@
args:
creates: '{{ openssl_certs_dir }}/{{ openssl_crt_signed }}'
when: cert_mode == "selfsigned"
notify: Restart Nginx webserver


- name: Upload contents of certificate file
Expand All @@ -96,6 +102,7 @@
group: root
mode: "0644"
when: cert_mode == "static"
notify: Restart Nginx webserver


- name: Upload contents of chain file
Expand All @@ -106,6 +113,7 @@
group: root
mode: "0644"
when: cert_mode == "static"
notify: Restart Nginx webserver


- name: Ensure CA chain is present
Expand All @@ -115,6 +123,7 @@
args:
creates: '{{ openssl_certs_dir }}/{{ openssl_chain }}'
when: cert_mode == "selfsigned"
notify: Restart Nginx webserver


- name: Ensure CA chain with signed certificate is present
Expand All @@ -124,6 +133,7 @@
args:
creates: '{{ openssl_certs_dir }}/{{ openssl_crt_signed_and_chain }}'
when: cert_mode == "selfsigned"
notify: Restart Nginx webserver


- name: Ensure Diffie-Hellman parameters (2048 bits) are present
Expand Down

0 comments on commit 69a5ff2

Please sign in to comment.