---

# Detect installed version (if any)
- block:
    - import_tasks: ../includes/webapps_set_install_mode.yml
      vars:
        - root_dir: "{{ bookstack_root_dir }}"
        - version: "{{ bookstack_version }}"
    - set_fact: bookstack_install_mode={{ (install_mode == 'upgrade' and not bookstack_manage_upgrade) | ternary('none',install_mode) }}
    - set_fact: bookstack_current_version={{ current_version | default('') }}
  tags: bookstack

# Create a random pass for the DB if needed
- block:
    - import_tasks: ../includes/get_rand_pass.yml
      vars:
        - pass_file: "{{ bookstack_root_dir }}/meta/ansible_dbpass"
    - set_fact: bookstack_db_pass={{ rand_pass }}
  when: bookstack_db_pass is not defined
  tags: bookstack
