The actions below are performed on the Ansible control node. You will need to create a playbook, create a new inventory file or edit the existing one, install all roles specified in the playbook and then launch the playbook.
Step 1. Create a playbook
Create a new directory, if necessary:
mkdir ~/playbooks
Go to the directory:
Create a new playbook and open it for editing:
nano playbook.yml
Add the following contents:
- hosts: documentserver
vars:
postgresql_global_config_options:
- option: listen_addresses
value: "*"
- option: unix_socket_directories
value: '{{ postgresql_unix_socket_directories | join(",") }}'
postgresql_hba_entries:
- type: local
database: all
user: postgres
auth_method: peer
- type: local
database: all
user: all
auth_method: peer
- type: host
database: all
user: all
address: 127.0.0.1/32
auth_method: md5
- type: host
database: all
user: all
address: ::1/128
auth_method: md5
- type: host
database: all
user: all
address: 0.0.0.0/0
auth_method: md5
postgresql_databases:
- name: "{{ db_server_name }}"
postgresql_users:
- name: "{{ db_server_user }}"
password: "{{ db_server_pass }}"
rabbitmq_users:
- name: "{{ rabbitmq_server_user }}"
password: "{{ rabbitmq_server_pass }}"
vhost: "{{ rabbitmq_server_vpath }}"
configure_priv: .*
read_priv: .*
write_priv: .*
tags: administrator
rabbitmq_users_remove: []
redis_bind_interface: 0.0.0.0
roles:
- role: geerlingguy.postgresql
- role: onlyoffice.rabbitmq
- role: geerlingguy.redis
- role: onlyoffice.documentserver
become: yes
Save the file.
The yml files are sensitive to formatting. If you change any values, ensure that you use spacing for indentation and check alignment. You can validate your modified file using any third-party
yaml validator.
The ONLYOFFICE roles must be specified in the same register which is used in the commands for installing these roles (see Step 3). I.e. if you specified - role: ONLYOFFICE.documentserver
in the playbook, install the role using the ansible-galaxy install ONLYOFFICE.documentserver
command, not ansible-galaxy install onlyoffice.documentserver
Step 2. Create an inventory file
Create a new inventory file and open it for editing:
nano inventory
Add the following content:
[documentserver]
managed_host1 ansible_user=root
managed_host2 ansible_user=root
managed_host3 ansible_user=root
Replace managed_host1
, managed_host2
, managed_host3
, etc. with actual IP addresses or domain names of managed nodes where you want to install ONLYOFFICE Docs.
Save the file.
Alternatively, you can add this list of hosts to your default /etc/ansible/hosts
file.
In the example above, the inventory file is added to the same directory where the playbook was created. If your inventory file is located in a different directory, you will need to specify the full path to the inventory file using the -i
parameter when launching the playbook (see Step4).
Step 3. Install the Ansible Roles for ONLYOFFICE Docs
Install all roles specified in the playbook using the following commands:
ansible-galaxy install onlyoffice.documentserver
ansible-galaxy install geerlingguy.postgresql
this command will install geerlingguy.postgresql v 3.4, in this case you can get the error with the TASK [geerlingguy.postgresql : Define postgresql_log_dir.] when launching the playbook. To avoid this error, you can remove the role using the following command: ansible-galaxy remove geerlingguy.postgresql
and instal a previous version of this role using the following command: ansible-galaxy install geerlingguy.postgresql,3.3.1
ansible-galaxy install onlyoffice.rabbitmq
ansible-galaxy install geerlingguy.redis
Step 4. Run the playbook
In the directory with the created playbook, run the following command:
ansible-playbook playbook.yml -i inventory
If your inventory file is located in a different directory, you need to specify the full path to the inventory file using the -i parameter. For example, if you add the [documentserver] list to the default hosts file, use the following command: ansible-playbook playbook.yml -i /etc/ansible/hosts
if you get the error with the TASK [geerlingguy.postgresql : Ensure PostgreSQL Python libraries are installed.], it can be solved by updating repositories cache on managed hosts with apt-get update. For this purpose, you can create a separate update.yml playbook with the following contents:
- hosts: documentserver
become: true
become_user: root
tasks:
- name: Update apt repo
apt: update_cache=yes
Execute update.yml and then run the playbook.yml again.
After executing the playbook.yml, ONLYOFFICE Docs with all dependencies will be installed on all managed hosts specified in your inventory file.
Available role variables are listed below, along with default values (see defaults/main.yml):
db_server_host: localhost
The IP address or the name of the host where the PostgreSQL server is running.
db_server_name: onlyoffice
The name of a PostgreSQL database to be created on the image startup.
db_server_user: onlyoffice
The new user name with superuser permissions for the PostgreSQL account.
db_server_pass: onlyoffice
The password set for the PostgreSQL account.
package_name: onlyoffice-documentserver
The package name of the ONLYOFFICE Document Server.
redis_server_host: localhost
The IP address or the name of the host where the Redis server is running.
redis_server_port: 6379
The Redis server port number.
rabbitmq_server_host: localhost
The IP address or the name of the host where the RabbitMQ server is running.
rabbitmq_server_user: guest
The new user name for the RabbitMQ account.
rabbitmq_server_pass: guest
The password set for the RabbitMQ account.
rabbitmq_server_vpath: /
The virtual path for the RabbitMQ server.
proto: http
The option to add ssl configuration or not.
key_file: "~/certs/tls.key"
The path to the key file.
cert_file: "~/certs/tls.crt"
The path to the certificate file.
cluster_mode: false
The option to enable or disable cluster mode.
start_example: false
The option for starting example service after installing.