Build a set of kubernetes resources using a 'kustomization.yaml' file.
Version added: 2.2.0
- Uses the kustomize or the kubectl tool.
- Return the result of
kustomize build
orkubectl kustomize
.
The below requirements are needed on the local Ansible controller node that executes this lookup.
- python >= 3.6
Note
- If both kustomize and kubectl are part of the PATH, kustomize will be used by the plugin.
- name: Run lookup using kustomize
ansible.builtin.set_fact:
resources: "{{ lookup('kubernetes.core.kustomize', binary_path='/path/to/kustomize') }}"
- name: Run lookup using kubectl kustomize
ansible.builtin.set_fact:
resources: "{{ lookup('kubernetes.core.kustomize', binary_path='/path/to/kubectl') }}"
- name: Create kubernetes resources for lookup output
kubernetes.core.k8s:
definition: "{{ lookup('kubernetes.core.kustomize', dir='/path/to/kustomization') }}"
- name: Create kubernetes resources for lookup output with `--enable-helm` set
kubernetes.core.k8s:
definition: "{{ lookup('kubernetes.core.kustomize', dir='/path/to/kustomization', enable_helm=True) }}"
Common return values are documented here, the following are the fields unique to this lookup:
- Aubin Bikouo (@abikouo)
Hint
Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.