.. _kubernetes.core.kustomize_lookup: ************************* kubernetes.core.kustomize ************************* **Build a set of kubernetes resources using a 'kustomization.yaml' file.** Version added: 2.2.0 .. contents:: :local: :depth: 1 Synopsis -------- - Uses the kustomize or the kubectl tool. - Return the result of ``kustomize build`` or ``kubectl kustomize``. Requirements ------------ The below requirements are needed on the local Ansible controller node that executes this lookup. - python >= 3.6 Parameters ---------- .. raw:: html
Parameter Choices/Defaults Configuration Comments
binary_path
-
The path of a kustomize or kubectl binary to use.
dir
-
Default:
"."
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.
opt_dirs
-
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 -------- .. code-block:: yaml - name: Run lookup using kustomize set_fact: resources: "{{ lookup('kubernetes.core.kustomize', binary_path='/path/to/kustomize') }}" - name: Run lookup using kubectl kustomize set_fact: resources: "{{ lookup('kubernetes.core.kustomize', binary_path='/path/to/kubectl') }}" - name: Create kubernetes resources for lookup output k8s: definition: "{{ lookup('kubernetes.core.kustomize', dir='/path/to/kustomization') }}" Return Values ------------- Common return values are documented `here `_, the following are the fields unique to this lookup: .. raw:: html
Key Returned Description
_list
complex
One ore more object definitions returned from the tool execution.

 
api_version
string
success
The versioned schema of this representation of an object.

 
kind
string
success
Represents the REST resource this object represents.

 
metadata
complex
success
Standard object metadata. Includes name, namespace, annotations, labels, etc.

 
spec
complex
success
Specific attributes of the object. Will vary based on the api_version and kind.

 
status
complex
success
Current status details for the object.



Status ------ Authors ~~~~~~~ - 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.