2021-02-19 08:00:20 -06:00
|
|
|
---
|
|
|
|
# Create OnlyOffice server for use with Nextcloud.
|
|
|
|
|
2021-02-20 07:44:54 -06:00
|
|
|
## Pre-Reqs ##
|
|
|
|
|
|
|
|
- name: Server | OnlyOffice | Pre-Requirements | Install
|
|
|
|
package:
|
2021-02-20 09:14:55 -06:00
|
|
|
name:
|
|
|
|
- gnupg
|
|
|
|
- python3-certbot-nginx
|
2021-02-20 07:44:54 -06:00
|
|
|
state: present
|
|
|
|
|
|
|
|
|
2021-02-19 08:00:20 -06:00
|
|
|
## Install ##
|
|
|
|
# https://helpcenter.onlyoffice.com/installation/docs-community-install-ubuntu.aspx
|
|
|
|
|
|
|
|
# Dependencies #
|
|
|
|
|
|
|
|
- name: Server | OnlyOffice | Postgres | Install
|
|
|
|
package:
|
|
|
|
name: postgresql
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Server | OnlyOffice | Postgres | Configure
|
|
|
|
shell: '{{ item }}'
|
|
|
|
loop:
|
2021-02-20 07:48:49 -06:00
|
|
|
- psql -c "CREATE DATABASE onlyoffice;"
|
|
|
|
- psql -c "CREATE USER onlyoffice WITH password 'onlyoffice';"
|
|
|
|
- psql -c "GRANT ALL privileges ON DATABASE onlyoffice TO onlyoffice;"
|
|
|
|
become_user: postgres
|
2021-02-20 07:44:54 -06:00
|
|
|
ignore_errors: yes
|
2021-02-19 08:00:20 -06:00
|
|
|
|
|
|
|
- name: Server | OnlyOffice | RabbitMQ | Install
|
|
|
|
package:
|
|
|
|
name: rabbitmq-server
|
|
|
|
state: present
|
|
|
|
|
|
|
|
# Actual Program #
|
|
|
|
|
|
|
|
- name: Server | OnlyOffice | Docs | Add Repo
|
|
|
|
shell: '{{ item }}'
|
|
|
|
loop:
|
2021-02-19 08:09:34 -06:00
|
|
|
- apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5
|
|
|
|
- echo "deb https://download.onlyoffice.com/repo/debian squeeze main" | tee /etc/apt/sources.list.d/onlyoffice.list
|
|
|
|
- apt update
|
2021-02-19 08:00:20 -06:00
|
|
|
|
|
|
|
- name: Server | OnlyOffice | Docs | Install
|
|
|
|
package:
|
|
|
|
name:
|
|
|
|
- ttf-mscorefonts-installer
|
|
|
|
- onlyoffice-documentserver
|
|
|
|
state: present
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## HTTPS ##
|
|
|
|
# https://helpcenter.onlyoffice.com/installation/docs-community-https-linux.aspx
|
2021-02-20 09:14:55 -06:00
|
|
|
|
|
|
|
# Certs #
|
|
|
|
|
|
|
|
- name: Server | OnlyOffice | HTTPS | Check For Cert
|
2021-02-20 09:35:57 -06:00
|
|
|
shell: ls -l /etc/letsencrypt/live/office.hyperling.com/{fullchain,privkey}.pem
|
2021-02-20 09:14:55 -06:00
|
|
|
register: onlyoffice_cert
|
|
|
|
|
|
|
|
- name: Server | OnlyOffice | HTTPS | Create Cert
|
2021-02-20 09:35:57 -06:00
|
|
|
shell: certbot --nginx -d office.hyperling.com
|
2021-02-20 09:14:55 -06:00
|
|
|
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:
|
2021-02-20 09:35:57 -06:00
|
|
|
# - { "regexp": "ssl_certificate ", "line": " ssl_certificate /etc/letsencrypt/live/office.hyperling.com/fullchain.pem" }
|
|
|
|
# - { "regexp": "ssl_certificate_key ", "line": " ssl_certificate_key /etc/letsencrypt/live/office.hyperling.com/privkey.pem" }
|
2021-02-20 09:14:55 -06:00
|
|
|
|
|
|
|
# Services #
|
|
|
|
|
|
|
|
- name: Server | OnlyOffice | HTTPS | Reload nginx
|
|
|
|
service:
|
|
|
|
name: nginx
|
|
|
|
status: reloaded
|