This Ansible role is based on the instructions for Installing ONLYOFFICE Docs Community Edition for Debian, Ubuntu, and derivatives.
This role can be used to configure a stand-alone ONLYOFFICE Document Server that uses Nginx and PostgreSQL or it can be used to install ONLYOFFICE Document Server on a LAMP server with Apache providing a reverse proxy service to Nginx and MariaDB / MySQL being used as the database.
There is a development repo available here that builds a Nextcloud server with ONLYOFFICE using this role.
This role checks the latest releases available at GitHub and required the full version string for apt
package for the onlyoffice_docserver_version
variable, a list of these can be found in vars/main.yml.
See the defaults/main.yml file for the default variables, the vars/main.yml file for the preset variables and the meta/argument_specs.yml file for the variable specification.
A boolean, set onlyoffice
to true
for the tasks in this role to be run, it defaults to false
.
The port number of the database server, quoted so it is a string, defaults to the default MariaDB / MySQL port, "3306"
, if PostgreSQL is used with the default port then onlyoffice_db_port
should be set to "5432"
.
The database type, a lowercase string, defaults to mariadb
, set to postgres
for PostgreSQL.
A list of debconf options for ONLYOFICE to be applied using the Ansible ansible.builtin.debconf module, for example:
onlyoffice_debconf:
- name: onlyoffice-documentserver
question: onlyoffice/cluster-mode
value: false
vtype: boolean
The four required variables for each list item:
A string, the name of the package to configure, for all items in the list this is set to onlyoffice-documentserver
.
A string, the debconf question.
A string, the value to set for the debconf question.
A string, the type of the value.
The version of the onlyoffice-documentserver
Debian package to be installed and pinned. This is set to prevent updates breaking production servers as this role sometimes needs updating for new versions of ONLYOFFICE.
The hostname used by Nginx to reverse proxy to.
The port used by Nginx to reverse proxy to.
The Nginx hostname.
The port number, quoted so it is string, that Nginx should make ONLYOFFICE available on, onlyoffice_ds_port
defaults to 443
, set it to another port if a reverse proxy is to be used in front of Nginx.
A YAML dictionary, which will be converted to JSON and written to /etc/onlyoffice/documentserver/local.json
.
ONLYOFFICE will merge the configuration in local.json
with the configuration from /etc/onlyoffice/documentserver/default.json
— this file contains the default configuration.
The path to the MariaDB socket, defaults to /run/mysqld/mysqld.sock
.
Add Nginx configuration for the ONLYOFFICE info to be available, onlyoffice_nginx_localhost
defaults to true
.
Domain name for the ONLYOFFICE info to be available on, onlyoffice_nginx_localhost_domain
defaults to localhost
.
Port for the ONLYOFFICE info to be available on, onlyoffice_nginx_localhost_port
defaults to 82
.
A list of disabled Nginx sites.
A list of enabled Nginx sites.
The RabbitMQ host, defaults to localhost
.
A string, the path to the TLS fullchain certificate for HTTPS.
A string, the path to the TLS private key for HTTPS.
A boolean, onlyoffice_verify
defaults to true
set it to false to skip the role using the ansible.builtin.validate_argument_spec module to verify variables that start with onlyoffice_
.
Action to take if the WOPI is defined in the existing ONLYOFFICE Document Server local.json
config but not the proposed config, defaults to fail
, the Molecule tests use ignore
.
After upgrading the Debian PostgreSQL needs to be upgraded:
pg_dropcluster --stop 13 main
pg_upgradecluster 11 main
apt remove postgresql-11 postgresql-client-11
debconf-show onlyoffice-documentserver
* onlyoffice/db-pwd: (password omitted)
* onlyoffice/rabbitmq-pwd: (password omitted)
* onlyoffice/jwt-secret: (password omitted)
* onlyoffice/db-port: 3306
* onlyoffice/jwt-enabled: true
* onlyoffice/db-host: localhost
* onlyoffice/rabbitmq-proto: amqp
* onlyoffice/ds-port: 8080
* onlyoffice/rabbitmq-user: onlyoffice
* onlyoffice/rabbitmq-host: localhost
* onlyoffice/jwt-header: AuthorizationJwt
* onlyoffice/db-name: onlyoffice
* onlyoffice/example-port: 3000
* onlyoffice/db-type: mariadb
* onlyoffice/db-user: onlyoffice
* onlyoffice/cluster-mode: false
* onlyoffice/remove-db: false
* onlyoffice/docservice-port: 8000
The default settings for this role result in Nginx listening on port 443 reverse proxying to ONLYOFFICE on port 8000.
If another web server is already listening on 443, for example Apache, then you can run Nginx on port 8080 and configure Apache as a reverse proxy to Nginx, for example:
<IfModule proxy_module>
ProxyRequests Off
ProxyAddHeaders Off
ProxyPassMatch "(.*)(\/websocket)$" "ws://127.0.0.1:8080/$1$2"
ProxyPass "/" "http://127.0.0.1:8080/"
ProxyPassReverse "/" "http://127.0.0.1:8080/"
</IfModule>
- Installing ONLYOFFICE Docs Community Edition for Debian, Ubuntu, and derivatives
- Switching ONLYOFFICE Docs to HTTPS protocol
- Ports which must be opened for ONLYOFFICE Docs
- ONLYOFFICE Document Server example configurations for proxy
- Nextcloud ONLYOFFICE integration app
- ONLYOFFICE Api Documentation - Signature
- ONLYOFFICE Web Application Open Platform Interface Protocol (WOPI)
The primary URL of this repo is https://git.coop/webarch/onlyoffice
however it is also mirrored to GitHub and available via Ansible Galaxy.
If you use this role please use a tagged release, see the release notes.
This role has been renamed from onlyoffice-documentserver
to onlyoffice
and also the repository has been moved, it was at https://git.coop/webarch/onlyoffice-documentserver
but is now at https://git.coop/webarch/onlyoffice
and the (not working) repo that was at this URL has been archived at https://git.coop/webarch/onlyoffice_docker
.
Copyright 2020-2025 Chris Croome, <[email protected]>.
This role is released under the same terms as Ansible itself, the GNU GPLv3.