---

- include_vars: "{{ item }}"
  with_first_found:
    - vars/{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml
    - vars/{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.yml
    - vars/{{ ansible_distribution }}.yml
    - vars/{{ ansible_os_family }}.yml
  tags: gitea

- import_tasks: ../includes/webapps_set_install_mode.yml
  vars:
    - root_dir: "{{ gitea_root_dir }}"
    - version: "{{ gitea_version }}"
  tags: gitea
- set_fact: gitea_install_mode={{ (install_mode == 'upgrade' and not gitea_manage_upgrade) | ternary('none',install_mode) }}
  tags: gitea
- set_fact: gitea_current_version={{ current_version | default('') }}
  tags: gitea

- import_tasks: ../includes/get_rand_pass.yml
  vars:
    - pass_file: "{{ gitea_root_dir }}/meta/ansible_key"
  tags: gitea
- set_fact: gitea_key={{ rand_pass }}
  tags: gitea

- import_tasks: ../includes/get_rand_pass.yml
  vars:
    - pass_file: "{{ gitea_root_dir }}/meta/ansible_dbpass"
  when: gitea_db_pass is not defined
  tags: gitea
- set_fact: gitea_db_pass={{ rand_pass }}
  when: gitea_db_pass is not defined
  tags: gitea

