CU-cunmht split ssl from http role to separate role

This commit is contained in:
Bastian de Byl
2020-09-29 21:40:01 -04:00
parent 89c2aff635
commit 137ddaca97
9 changed files with 57 additions and 63 deletions

View File

@@ -0,0 +1,3 @@
---
dependencies:
- role: common

View File

@@ -0,0 +1,25 @@
---
- name: generate openssl dhparam for nginx
become: true
command: |
openssl dhparam -dsaparam -out /etc/ssl/certs/dhparam.pem 2048
args:
creates: /etc/ssl/certs/dhparam.pem
tags: ssl
- name: create ssl certificate for ci server
become: true
command: |
certbot certonly --webroot --webroot-path=/srv/http \
-m {{ ci_server_email }} --agree-tos \
-d {{ ci_server_name }}
args:
creates: "/etc/letsencrypt/live/{{ ci_server_name }}"
tags: ssl
- name: check if certbot certificate was created
become: true
stat:
path: "/etc/letsencrypt/live/{{ ci_server_name }}"
register: stat_result
tags: ssl

View File

@@ -0,0 +1,10 @@
---
- name: renew certbot ssl certificates weekly
become: true
cron:
name: certbot_renew
special_time: weekly
job: |
certbot renew --pre-hook "systemctl stop nginx" \
--post-hook "systemctl start nginx"
tags: cron

View File

@@ -0,0 +1,3 @@
---
- import_tasks: certbot.yml
- import_tasks: cron.yml