From a40a1e73f14c3c577a55fc652c5668d6bf9aeffa Mon Sep 17 00:00:00 2001 From: Hyperling Date: Sat, 20 Feb 2021 09:14:55 -0600 Subject: [PATCH] Add HTTPS config. Cerbot automatically configures existing ds.conf so no need for copying template. --- tasks/server/onlyoffice.yml | 43 ++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/tasks/server/onlyoffice.yml b/tasks/server/onlyoffice.yml index 3975f88..17c2a5c 100644 --- a/tasks/server/onlyoffice.yml +++ b/tasks/server/onlyoffice.yml @@ -5,7 +5,9 @@ - name: Server | OnlyOffice | Pre-Requirements | Install package: - name: gnupg + name: + - gnupg + - python3-certbot-nginx state: present @@ -53,3 +55,42 @@ ## HTTPS ## # https://helpcenter.onlyoffice.com/installation/docs-community-https-linux.aspx + +# Certs # + +- name: Server | OnlyOffice | HTTPS | Check For Cert + shell: ls -l /etc/letsencrypt/live/docs.hyperling.com/{fullchain,privkey}.pem + register: onlyoffice_cert + +- name: Server | OnlyOffice | HTTPS | Create Cert + shell: certbot --nginx -d docs.hyperling.com + when: onlyoffice_cert.failed + +# Config # + +#- name: Server | OnlyOffice | HTTPS | Check For Config +# shell: ls -l /etc/onlyoffice/documentserver/nginx/ds.conf +# register: onlyoffice_cert +# +#- name: Server | OnlyOffice | HTTPS | Create Config +# shell: cp -f /etc/onlyoffice/documentserver/nginx/ds-ssl.conf.tmpl /etc/onlyoffice/documentserver/nginx/ds.conf +# when: onlyoffice_cert.failed +# +#- name: Server | OnlyOffice | HTTPS | Modify Config +# lineinfile: +# path: /etc/onlyoffice/documentserver/nginx/ds.conf +# regexp: '{{ item.regexp }}' +# line: '{{ item.line }}; # MANAGED BY ANSIBLE' +# state: present +# create: no +# backup: yes +# loop: +# - { "regexp": "ssl_certificate ", "line": " ssl_certificate /etc/letsencrypt/live/docs.hyperling.com/fullchain.pem" } +# - { "regexp": "ssl_certificate_key ", "line": " ssl_certificate_key /etc/letsencrypt/live/docs.hyperling.com/privkey.pem" } + +# Services # + +- name: Server | OnlyOffice | HTTPS | Reload nginx + service: + name: nginx + status: reloaded \ No newline at end of file