---

- set_fact:
    oo_services:
      - ds-converter
      - ds-docservice
      - ds-metrics
  tags: oo

- when: oo_db_pass is not defined
  block:
    - import_tasks: ../includes/get_rand_pass.yml
      vars:
        - pass_file: /etc/onlyoffice/meta/ansible_db_pass
    - set_fact: oo_db_pass={{ rand_pass }}
  tags: oo

- when: oo_link_secret is not defined
  block:
    - import_tasks: ../includes/get_rand_pass.yml
      vars:
        - pass_file: /etc/onlyoffice/meta/ansible_link_secret
        - complex: False
        - pass_size: 30
    - set_fact: oo_link_secret={{ rand_pass }}
  tags: oo

- name: Detect installed version
  shell: rpm -q --qf "%{version}-%{release}" onlyoffice-documentserver || echo 0
  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

