kubernetes.core.k8s_config_resource_name filter – Generate resource name for the given resource of type ConfigMap, Secret

Note

This filter plugin is part of the kubernetes.core collection (version 2.4.2).

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.

To use it in a playbook, specify: kubernetes.core.k8s_config_resource_name.

Synopsis

  • Generate resource name for the given resource of type ConfigMap, Secret.

  • Resource must have a metadata.name key to generate a resource name

Input

This describes the input of the filter, the value before | kubernetes.core.k8s_config_resource_name.

Parameter

Comments

Input

dictionary / required

A valid YAML definition for a ConfigMap or a Secret.

Examples

# Dump generated name for a configmap into a variable
- set_fact:
    generated_name: '{{ definition | kubernetes.core.k8s_config_resource_name }}'
  vars:
    definition:
      apiVersion: v1
      kind: ConfigMap
      metadata:
        name: myconfigmap
        namespace: mynamespace

Return Value

Key

Description

Return value

string

Generated resource name.

Returned: success

Authors

  • ansible cloud team

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.