ansible / ansible.builtin / v2.8.13 / lookup / varnames Lookup matching variable names | "added in version" 2.8 of ansible.builtin" Authors: Ansible Coreansible.builtin.varnames (v2.8.13) — lookup
pip
Install with pip install ansible==2.8.13
Retrieves a list of matching Ansible variable names.
- name: List variables that start with qz_ debug: msg="{{ lookup('varnames', '^qz_.+')}}" vars: qz_1: hello qz_2: world qa_1: "I won't show" qz_: "I won't show either"
- name: Show all variables debug: msg="{{ lookup('varnames', '.+')}}"
- name: Show variables with 'hosts' in their names debug: msg="{{ lookup('varnames', 'hosts')}}"
- name: Find several related variables that end specific way debug: msg="{{ lookup('varnames', '.+_zone$', '.+_location$') }}"
_terms: description: List of Python regex patterns to search for in variable names. required: true
_value: description: - List of the variable names requested. type: list