Note
This lookup plugin is part of the kubernetes.core collection (version 5.3.0).
You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install kubernetes.core. You need further requirements to be able to use this lookup plugin, see Requirements for details.
To use it in a playbook, specify: kubernetes.core.kustomize.
New in kubernetes.core 2.2.0
kustomize build or kubectl kustomize.The below requirements are needed on the local controller node that executes this lookup.
This describes keyword parameters of the lookup. These are the values key1=value1, key2=value2 and so on in the following examples: lookup('kubernetes.core.kustomize', key1=value1, key2=value2, ...) and query('kubernetes.core.kustomize', key1=value1, key2=value2, ...)
Parameter | Comments |
|---|---|
binary_path string | The path of a kustomize or kubectl binary to use. |
dir string | The directory path containing ‘kustomization.yaml’, or a git repository URL with a path suffix specifying same with respect to the repository root. If omitted, ‘.’ is assumed. Default: |
enable_helm string | Enable the helm chart inflation generator Default: |
opt_dirs string | An optional list of directories to search for the executable in addition to PATH. |
Note
- 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) }}"
Key | Description |
|---|---|
Return value string | YAML string for the object definitions returned from the tool execution. Returned: success Sample: |
© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/kubernetes/core/kustomize_lookup.html