ansible.builtin.extract (v2.16.0) — filter

extract a value based on an index or key

| "added in version" 2.1 of ansible.builtin"

Authors: unknown

Install Ansible via pip

Install with pip install ansible-core==2.16.0

Description

Extract a value from a list or dictionary based on an index/key.

User must ensure that index or key used matches the type of container.

Equivalent of using C(list[index]) and C(dictionary[key]) but useful as a filter to combine with C(map).

Inputs

    
_input:
    description: Index or key to extract.
    required: true
    type: raw

morekeys:
    description: Indicies or keys to extract from the initial result (subkeys/subindices).
    elements: dictionary
    required: true
    type: list

container:
    description: Dictionary or list from which to extract a value.
    required: true
    type: raw

Outputs

_value:
  description: Resulting merge of supplied dictionaries.
  type: dict