---

- fail: msg="mysql_admin_pass must be set"
  when: mysql_admin_pass is not defined
  tags: mayan

# Ensure we have recent enough MariaDB version
- fail: msg="Require MariaDB > 10"
  when:
    - mayan_db_server == 'localhost' or mayan_db_server == '127.0.0.1'
    - mysql_mariadb_version == 'default'
  tags: mayan

- import_tasks: ../includes/webapps_set_install_mode.yml
  vars:
    - root_dir: "{{ mayan_root_dir }}"
    - version: "{{ mayan_version }}"
  tags: mayan

- block:
    - set_fact: mayan_install_mode={{ (install_mode == 'upgrade' and not mayan_manage_upgrade) | ternary('none',install_mode) }}
    - set_fact: mayan_current_version={{ current_version | default('') }}
  tags: mayan

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


