Dashboard
PHP:
8.2.30
OS:
Linux
User:
dh_nv8b2m
/
/
usr
/
local
/
lib
/
python3.10
/
dist-packages
/
ansible
/
plugins
/
lookup
/
__pycache__
📤 Upload
📝 New File
📁 New Folder
Close
Editing: varnames.cpython-310.pyc
o O�h# � @ sd d dl mZ dZdZdZd dlZd dlmZ d dlm Z d dl mZ d d lm Z G d d� de �ZdS )� )�annotationsa� name: varnames author: Ansible Core Team version_added: "2.8" short_description: Lookup matching variable names description: - Retrieves a list of matching Ansible variable names. options: _terms: description: List of Python regex patterns to search for in variable names. required: True seealso: - plugin_type: lookup plugin: ansible.builtin.vars a$ - name: List variables that start with qz_ ansible.builtin.debug: msg="{{ lookup('ansible.builtin.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 ansible.builtin.debug: msg="{{ lookup('ansible.builtin.varnames', '.+') }}" - name: Show variables with 'hosts' in their names ansible.builtin.debug: msg="{{ q('varnames', 'hosts') }}" - name: Find several related variables that end specific way ansible.builtin.debug: msg="{{ query('ansible.builtin.varnames', '.+_zone$', '.+_location$') }}" - name: display values from variables found via varnames (note "*" is used to dereference the list to a 'list of arguments') debug: msg="{{ lookup('vars', *lookup('varnames', 'ansible_play_.+')) }}" zQ _value: description: - List of the variable names requested. type: list N)�AnsibleError)� to_native)�string_types)� LookupBasec @ s e Zd Zddd�ZdS )�LookupModuleNc K s� |d u rt d��| j||d� g }t|�� �}|D ]>}t|t�s*t d|t|�f ��zt�|�}W n t yG } z t d|t |�f ��d }~ww |D ]} |�| �rV|�| � qJq|S )Nz No variables available to search)�var_options�directz<Invalid setting identifier, "%s" is not a string, it is a %sz,Unable to use "%s" as a search parameter: %s) r �set_options�list�keys� isinstancer �type�re�compile� Exceptionr �search�append) �self�terms� variables�kwargs�ret�variable_names�term�name�e�varname� r �J/usr/local/lib/python3.10/dist-packages/ansible/plugins/lookup/varnames.py�run= s( �� ��zLookupModule.run)N)�__name__� __module__�__qualname__r r r r r r ; s r )� __future__r � DOCUMENTATION�EXAMPLES�RETURNr �ansible.errorsr �+ansible.module_utils.common.text.convertersr �ansible.module_utils.sixr �ansible.plugins.lookupr r r r r r �<module> s
Save
Cancel