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 5.1.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
.
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 |
---|---|
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 |
---|---|
Generated resource name. Returned: success |