kubernetes.core.kustomize lookup – Build a set of kubernetes resources using a ‘kustomization.yaml’ file.
Note
This lookup plugin is part of the kubernetes.core collection (version 3.2.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
Synopsis
Uses the kustomize or the kubectl tool.
Return the result of
kustomize build
orkubectl kustomize
.
Requirements
The below requirements are needed on the local controller node that executes this lookup.
python >= 3.6
Keyword parameters
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 |
---|---|
The path of a kustomize or kubectl binary to use. |
|
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 the helm chart inflation generator Default: |
|
An optional list of directories to search for the executable in addition to PATH. |
Notes
Note
If both kustomize and kubectl are part of the PATH, kustomize will be used by the plugin.
Examples
- 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) }}"
Return Value
Key |
Description |
---|---|
YAML string for the object definitions returned from the tool execution. Returned: success Sample: |