---
- name: Create directory structure
  file:
    path: "{{ gitea_root_dir }}/{{ item.dir }}"
    state: directory
    owner: "{{ item.owner | default('gitea') }}"
    group: "{{ item.group | default('gitea') }}"
    mode: "{{ item.mode | default('750') }}"
  loop:
    - dir: /
      owner: gitea
      group: gitea
    - dir: data
    - dir: data/repositories
    - dir: custom
    - dir: public
    - dir: etc
    - dir: tmp
    - dir: bin
    - dir: meta
      owner: root
      group: root
      mode: 700
    - dir: backup
      owner: root
      group: root
      mode: 700
  tags: gitea
