--- #https://github.com/bitnami/charts/tree/master/bitnami/mariadb - name: Create a namespace for mariadb k8s: kubeconfig: "/etc/rancher/k3s/k3s.yaml" name: "{{apps.mariadb.namespace}}" api_version: v1 kind: Namespace state: "{{apps.mariadb.state}}" become: true - name: create persistent volume resources kubernetes.core.k8s: kubeconfig: "/etc/rancher/k3s/k3s.yaml" state: "{{apps.mariadb.state}}" definition: "{{ lookup('template', item) | from_yaml }}" loop: - mariadb/pv.yaml - mariadb/pv-claim.yaml become: true - name: create secret for mariadb kubernetes.core.k8s: kubeconfig: "/etc/rancher/k3s/k3s.yaml" state: "{{apps.mariadb.state}}" definition: apiVersion: v1 kind: Secret type: Opaque metadata: name: mariadb-secrets namespace: "{{apps.mariadb.namespace}}" stringData: mariadb-password: "{{apps.mariadb.secrets.password}}" mariadb-root-password: "{{apps.mariadb.secrets.root_password}}" mariadb-replication-password: "{{apps.mariadb.secrets.replication_password}}" become: true - name: Install mariadb globally available block: - name: Add mariadb chart helm repo local_action: module: kubernetes.core.helm_repository name: bitnami repo_url: https://charts.bitnami.com/bitnami - name: load variables files/mariadb/values.yaml ansible.builtin.include_vars: file: files/mariadb/values.yaml name: stash_values - name: Install mariadb Release local_action: module: kubernetes.core.helm release_state: "{{apps.mariadb.state}}" name: mariadb namespace: "{{apps.mariadb.namespace}}" create_namespace: yes update_repo_cache: True chart_ref: bitnami/mariadb values: "{{stash_values}}" wait: true