---

- name: DEBUG
  copy:
    dest: /tmp/gitea_values.yaml
    content: '{{ k8s_gitea_helm__release_values | to_nice_yaml }}'
    mode: '0400'
    owner: root
    group: root
  when:
  - debug
  - inventory_hostname == groups['kube_control_plane'][0]
  tags:
    - gitea

- name: Deploy gitea inside namespace
  become: yes
  kubernetes.core.helm:
    create_namespace: yes
    name: "gitea"
    chart_ref: "{{ k8s_gitea_helm__chart_ref | default('gitea') }}"
    chart_repo_url: "{{ k8s_gitea_helm__chart_repo_url | default('https://dl.gitea.io/charts/') }}"
    chart_version: 8.0.2
    release_namespace: "{{ k8s_gitea_helm__release_namespace | default('gitea') }}"
    release_values: "{{ k8s_gitea_helm__release_values }}"
  when:
  - inventory_hostname == groups['kube_control_plane'][0]
  tags:
    - gitea
