|
|
|
---
|
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
oo_services:
|
|
|
|
- documentserver-converter
|
|
|
|
- documentserver-docservice
|
|
|
|
- documentserver-metrics
|
|
|
|
- documentserver-spellchecker
|
|
|
|
tags: oo
|
|
|
|
|
|
|
|
- name: Create a system user
|
|
|
|
user:
|
|
|
|
name: ds
|
|
|
|
comment: OnlyOffice Document Server
|
|
|
|
system: True
|
|
|
|
home: /var/www/onlyoffice
|
|
|
|
shell: /sbin/nologin
|
|
|
|
tags: oo
|
|
|
|
|
|
|
|
- name: Install packages
|
|
|
|
yum:
|
|
|
|
name:
|
|
|
|
- gcc-c++ # needed to rebuild modules for spellchecker
|
|
|
|
- rabbitmq-server
|
|
|
|
- nodejs
|
|
|
|
- onlyoffice-documentserver
|
|
|
|
tags: oo
|
|
|
|
|
|
|
|
- name: Create meta directory
|
|
|
|
file: path=/etc/onlyoffice/meta state=directory mode=700
|
|
|
|
tags: oo
|
|
|
|
|
|
|
|
- name: Fix permissions on onlyoffice web resources
|
|
|
|
file: path=/var/www/onlyoffice state=directory mode=755
|
|
|
|
tags: oo
|
|
|
|
|
|
|
|
- import_tasks: ../includes/get_rand_pass.yml
|
|
|
|
vars:
|
|
|
|
- pass_file: /etc/onlyoffice/meta/ansible_db_pass
|
|
|
|
tags: oo
|
|
|
|
- set_fact: oo_db_pass={{ rand_pass }}
|
|
|
|
when: oo_db_pass is not defined
|
|
|
|
tags: oo
|
|
|
|
|
|
|
|
- import_tasks: ../includes/webapps_create_mysql_db.yml
|
|
|
|
vars:
|
|
|
|
- db_name: "{{ oo_db_name }}"
|
|
|
|
- db_user: "{{ oo_db_user }}"
|
|
|
|
- db_server: "{{ oo_db_server }}"
|
|
|
|
- db_pass: "{{ oo_db_pass }}"
|
|
|
|
tags: oo
|
|
|
|
|
|
|
|
- name: Load MySQL schema
|
|
|
|
mysql_db:
|
|
|
|
name: "{{ oo_db_name }}"
|
|
|
|
state: import
|
|
|
|
target: /var/www/onlyoffice/documentserver/server/schema/mysql/createdb.sql
|
|
|
|
login_host: "{{ oo_db_server }}"
|
|
|
|
login_user: sqladmin
|
|
|
|
login_password: "{{ mysql_admin_pass }}"
|
|
|
|
when: db_created.changed
|
|
|
|
tags: oo
|
|
|
|
|
|
|
|
- name: Deploy configuration
|
|
|
|
template: src={{ item }}.j2 dest=/etc/onlyoffice/documentserver/{{ item }} owner=ds group=ds mode=440
|
|
|
|
loop:
|
|
|
|
- oods.json
|
|
|
|
notify: restart documentserver
|
|
|
|
tags: oo
|
|
|
|
|
|
|
|
- name: Set permissions for default conf
|
|
|
|
file: path=/etc/onlyoffice/documentserver/{{ item }} mode=644
|
|
|
|
loop:
|
|
|
|
- default.json
|
|
|
|
- development-mac.json
|
|
|
|
- development-windows.json
|
|
|
|
- production-linux.json
|
|
|
|
- log4js/development.json
|
|
|
|
- log4js/production.json
|
|
|
|
tags: oo
|
|
|
|
|
|
|
|
- name: Fix permissions on data dir
|
|
|
|
command: chown -R ds:ds /var/lib/onlyoffice/documentserver/
|
|
|
|
args:
|
|
|
|
warn: False
|
|
|
|
changed_when: False
|
|
|
|
tags: oo
|
|
|
|
|
|
|
|
- name: Deploy nginx configuration
|
|
|
|
template: src=nginx_vhost.conf.j2 dest=/etc/nginx/ansible_conf.d/32-oods.conf
|
|
|
|
notify: reload nginx
|
|
|
|
tags: oo
|
|
|
|
|
|
|
|
- name: Create /etc/system/system
|
|
|
|
file: path=/etc/systemd/system state=directory
|
|
|
|
tags: oo
|
|
|
|
|
|
|
|
- name: Deploy systemd service units
|
|
|
|
template: src={{ item }}.service.j2 dest=/etc/systemd/system/{{ item }}.service
|
|
|
|
loop: "{{ oo_services }}"
|
|
|
|
register: oo_units
|
|
|
|
notify: restart documentserver
|
|
|
|
tags: oo
|
|
|
|
|
|
|
|
- name: Reload systemd
|
|
|
|
systemd: daemon_reload=True
|
|
|
|
when: oo_units.results | selectattr('changed','equalto',True) | list | length > 0
|
|
|
|
tags: oo
|
|
|
|
|
|
|
|
- name: Stop and disable supervisord
|
|
|
|
systemd: name=supervisord state=stopped enabled=False masked=True
|
|
|
|
tags: oo
|
|
|
|
|
|
|
|
- name: Remove obsolete services
|
|
|
|
file: path=/etc/systemd/system/{{ item }}.service state=absent
|
|
|
|
loop:
|
|
|
|
- documentserver-gc
|
|
|
|
register: oo_obsolete_units
|
|
|
|
tags: oo
|
|
|
|
|
|
|
|
- name: Reload systemd
|
|
|
|
systemd: daemon_reload=True
|
|
|
|
when: oo_obsolete_units.changed
|
|
|
|
tags: oo
|
|
|
|
|
|
|
|
- name: Start and enable RabbitMQ server
|
|
|
|
service: name=rabbitmq-server state=started enabled=True
|
|
|
|
tags: oo
|
|
|
|
|
|
|
|
- name: Start and enable documentserver services
|
|
|
|
service: name={{ item }} state=started enabled=True
|
|
|
|
loop: "{{ oo_services }}"
|
|
|
|
tags: oo
|
|
|
|
|