---
# Get secrets 
- include_tasks: ../functions/get_secret.yml
  with_items:
    - { path: /srv/gitea/mysql_root_pw, length: 24 }
    - { path: /srv/gitea/mysql_user_pw, length: 12 }

- name: create folder struct for gitea
  file: 
    path: "{{item}}" 
    state: "directory"
    owner: 1000
    group: 1000
  with_items:
    - "/srv/gitea/db/"
    - "/srv/gitea/data/"

- name: Konfig-Dateien erstellen
  template: 
    src: "{{item}}" 
    dest: "/srv/gitea/{{item}}"
  with_items:
    - "docker-compose.yml"

- name: start gitea docker
  docker_compose:
    project_src: /srv/gitea/
    state: present
  
