# deployment task for bunkerweb
# https://docs.bunkerweb.io/1.6.6/integrations/#kubernetes


#- name: Create a namespace for bunkerweb
#  k8s:
#    kubeconfig: "/etc/rancher/k3s/k3s.yaml"
#    name: "{{apps.bunkerweb.namespace}}"
#    api_version: v1
#    kind: Namespace
#    state: "{{apps.bunkerweb.state}}"
#  become: true

- name: Install bunkerweb instance
  block:
    - name: Add bunkerweb chart helm repo
      local_action:
        module: kubernetes.core.helm_repository
        name: bunkerweb
        repo_url: https://repo.bunkerweb.io/charts

    - name: load variables files/bunkerweb/values.yaml
      ansible.builtin.include_vars:
        file: files/bunkerweb/values.yaml
        name: release_values

    - name: Install bunkerweb chart
      local_action:
        module: kubernetes.core.helm
        release_state: "{{apps.bunkerweb.state}}"
        name: bunkerweb-1765770291
        namespace: "{{apps.bunkerweb.namespace}}"
        update_repo_cache: True
        chart_ref: bunkerweb/bunkerweb
        values: "{{release_values}}"
        wait: true
