From 8a2246d5c23b4e7443be1243ed4b3e47294ab155 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Mon, 4 Jan 2021 18:00:08 +0100 Subject: [PATCH] Update to 2021-01-04 18:00 --- roles/onlyoffice_document_server/meta/main.yml | 1 - roles/onlyoffice_document_server/tasks/facts.yml | 17 +++++++++++++++++ roles/onlyoffice_document_server/tasks/install.yml | 15 +++++++++++++-- roles/onlyoffice_document_server/tasks/main.yml | 1 + .../onlyoffice_document_server/tasks/write_version.yml | 14 ++++++++++++++ 5 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 roles/onlyoffice_document_server/tasks/write_version.yml diff --git a/roles/onlyoffice_document_server/meta/main.yml b/roles/onlyoffice_document_server/meta/main.yml index 811ad16..b622d82 100644 --- a/roles/onlyoffice_document_server/meta/main.yml +++ b/roles/onlyoffice_document_server/meta/main.yml @@ -2,7 +2,6 @@ dependencies: - role: repo_onlyoffice - - role: repo_nodejs - role: nginx - role: redis_server - role: rabbitmq_server diff --git a/roles/onlyoffice_document_server/tasks/facts.yml b/roles/onlyoffice_document_server/tasks/facts.yml index bb4dfc5..923241f 100644 --- a/roles/onlyoffice_document_server/tasks/facts.yml +++ b/roles/onlyoffice_document_server/tasks/facts.yml @@ -15,3 +15,20 @@ - pass_file: /etc/onlyoffice/meta/ansible_db_pass - set_fact: oo_db_pass={{ rand_pass }} tags: oo + +- name: Detect installed version + shell: rpm -q --qf "%{version}-%{release}" onlyoffice-documentserver || echo 0 + args: + warn: False + register: oo_current_version + changed_when: False + tags: oo + +- block: + - import_tasks: ../includes/webapps_set_install_mode.yml + vars: + - root_dir: /etc/onlyoffice/ + - version: "{{ oo_current_version.stdout }}" + - set_fact: oo_install_mode={{ install_mode }} + tags: oo + diff --git a/roles/onlyoffice_document_server/tasks/install.yml b/roles/onlyoffice_document_server/tasks/install.yml index a543a45..4611616 100644 --- a/roles/onlyoffice_document_server/tasks/install.yml +++ b/roles/onlyoffice_document_server/tasks/install.yml @@ -3,11 +3,22 @@ - name: Install packages yum: name: - - gcc-c++ # needed to rebuild modules for spellchecker - - nodejs - onlyoffice-documentserver tags: oo + # Font generation migh fail during upgrades, which can result in a broken install + # like https://github.com/ONLYOFFICE/DocumentServer/issues/1106 +- when: oo_install_mode != 'none' + block: + - name: Stop services + service: name={{ item }} state=stopped + loop: "{{ oo_services }}" + failed_when: False # don't fail on initial install when the services doesn't exist yet + + - name: Generate fonts + command: documentserver-generate-allfonts.sh true + tags: oo + - name: Fix permissions on onlyoffice web resources file: path=/var/www/onlyoffice state=directory mode=755 tags: oo diff --git a/roles/onlyoffice_document_server/tasks/main.yml b/roles/onlyoffice_document_server/tasks/main.yml index 6a57ac0..f087264 100644 --- a/roles/onlyoffice_document_server/tasks/main.yml +++ b/roles/onlyoffice_document_server/tasks/main.yml @@ -8,3 +8,4 @@ - include: selinux.yml when: ansible_selinux.status == 'enabled' - include: services.yml +- include: write_version.yml diff --git a/roles/onlyoffice_document_server/tasks/write_version.yml b/roles/onlyoffice_document_server/tasks/write_version.yml new file mode 100644 index 0000000..adff3fa --- /dev/null +++ b/roles/onlyoffice_document_server/tasks/write_version.yml @@ -0,0 +1,14 @@ +--- + +- name: Detect installed version + shell: rpm -q --qf "%{version}-%{release}" onlyoffice-documentserver || echo 0 + args: + warn: False + register: oo_current_version + changed_when: False + #when: oo_current_version | string == '0' # Only detect again on first install + tags: oo + +- name: Write current version + copy: content={{ oo_current_version.stdout }} dest=/etc/onlyoffice/meta/ansible_version + tags: oo