kubernetes.core.kustomize (3.0.1) — lookup

Build a set of kubernetes resources using a 'kustomization.yaml' file.

| "added in version" 2.2.0 of kubernetes.core"

Authors: Aubin Bikouo (@abikouo)

Install collection

Install with ansible-galaxy collection install kubernetes.core:==3.0.1


Add to requirements.yml

  collections:
    - name: kubernetes.core
      version: 3.0.1

Description

Uses the kustomize or the kubectl tool.

Return the result of C(kustomize build) or C(kubectl kustomize).


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Run lookup using kustomize
  set_fact:
    resources: "{{ lookup('kubernetes.core.kustomize', binary_path='/path/to/kustomize') }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Run lookup using kubectl kustomize
  set_fact:
    resources: "{{ lookup('kubernetes.core.kustomize', binary_path='/path/to/kubectl') }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create kubernetes resources for lookup output
  k8s:
    definition: "{{ lookup('kubernetes.core.kustomize', dir='/path/to/kustomization') }}"

Inputs

    
dir:
    default: .
    description:
    - 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:
    description:
    - An optional list of directories to search for the executable in addition to PATH.

binary_path:
    description:
    - The path of a kustomize or kubectl binary to use.

Outputs

_list:
  description:
  - YAML string for the object definitions returned from the tool execution.
  sample:
    apiVersion: v1
    data:
      key1: val1
    kind: ConfigMap
    metadata:
      name: my-config-map
      namespace: default
  type: str