- name: Prepare namespaces
  kubernetes.core.k8s:
    apply: true
    kubeconfig: ./kubeconfig
    validate:
      strict: true
      fail_on_error: true
    state: present
    definition:
      apiVersion: v1
      kind: Namespace
      metadata:
        name: "{{ item.namespace }}"
  loop: "{{ ocp_bootstrap_secrets | default([]) }}"

- name: Deploy the secrets
  kubernetes.core.k8s:
    apply: true
    kubeconfig: ./kubeconfig
    validate:
      strict: true
      fail_on_error: true
    state: present
    definition:
      apiVersion: v1
      kind: Secret
      data: "{{ item.secrets }}"
      metadata:
        name: "{{ item.name }}"
        namespace: "{{ item.namespace }}"
        labels: "{{ item.labels }}"
  loop: "{{ ocp_bootstrap_secrets | default([]) }}"  
 