Optimized deployment process

This commit is contained in:
Kevin Veen-Birkenbach 2021-04-05 16:22:55 +02:00
parent 038b0d3a65
commit 8b1a97a26d
5 changed files with 21 additions and 3 deletions

View File

@ -9,3 +9,9 @@
state: restarted state: restarted
enabled: yes enabled: yes
daemon_reload: yes daemon_reload: yes
- name: "restart deploy-letsencrypt-mailu.timer"
systemd:
name: deploy-letsencrypt-mailu.timer
state: restarted
enabled: yes
daemon_reload: yes

View File

@ -14,7 +14,7 @@
path: "/etc/mailu" path: "/etc/mailu"
state: directory state: directory
mode: 0755 mode: 0755
- name: "create /etc/mailu/certs" - name: "create /etc/mailu/certs"
file: file:
path: "/etc/mailu/certs" path: "/etc/mailu/certs"
@ -41,3 +41,7 @@
- name: configure deploy-letsencrypt-mailu.service - name: configure deploy-letsencrypt-mailu.service
template: src=deploy-letsencrypt-mailu.service.j2 dest=/etc/systemd/system/deploy-letsencrypt-mailu.service template: src=deploy-letsencrypt-mailu.service.j2 dest=/etc/systemd/system/deploy-letsencrypt-mailu.service
notify: restart deploy-letsencrypt-mailu.service notify: restart deploy-letsencrypt-mailu.service
- name: configure deploy-letsencrypt-mailu.timer
template: src=deploy-letsencrypt-mailu.timer.j2 dest=/etc/systemd/system/deploy-letsencrypt-mailu.timer
notify: restart deploy-letsencrypt-mailu.timer

View File

@ -1,7 +1,6 @@
[Unit] [Unit]
Description=Let's Encrypt Mailu Deploy Description=Let's Encrypt Mailu Deploy
OnFailure=systemd-email@%n.service OnFailure=systemd-email@%n.service
After=nginx.service
[Service] [Service]
Type=oneshot Type=oneshot

View File

@ -1,5 +1,4 @@
#!/bin/sh #!/bin/sh
cp /etc/letsencrypt/live/{{domain}}/privkey.pem /etc/mailu/certs/key.pem || exit 1 cp /etc/letsencrypt/live/{{domain}}/privkey.pem /etc/mailu/certs/key.pem || exit 1
cp /etc/letsencrypt/live/{{domain}}/fullchain.pem /etc/mailu/certs/cert.pem || exit 1 cp /etc/letsencrypt/live/{{domain}}/fullchain.pem /etc/mailu/certs/cert.pem || exit 1
sudo cp /etc/letsencrypt/live/{{domain}} /etc/mailu/letsencrypt/ || exit 1
docker exec mailu_front_1 nginx -s reload docker exec mailu_front_1 nginx -s reload

View File

@ -0,0 +1,10 @@
[Unit]
Description=Twice daily deployment of Let's Encrypt's certificates
[Timer]
OnCalendar=0/12:00:00
RandomizedDelaySec=1h
Persistent=true
[Install]
WantedBy=timers.target