HEX
Server: LiteSpeed
System: Linux kapuas.iixcp.rumahweb.net 5.14.0-427.42.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Nov 1 14:58:02 EDT 2024 x86_64
User: mirz4654 (1666)
PHP: 8.1.33
Disabled: system,exec,escapeshellarg,escapeshellcmd,passthru,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,popen,pclose,dl,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setsid,posix_setuid,posix_setpgid,ini_alter,show_source,define_syslog_variables,symlink,syslog,openlog,openlog,closelog,ocinumcols,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dll,ftp,myshellexec,socket_bind,mail,posix_getwpuid
Upload Files
File: //lib/python3.9/site-packages/ansible/plugins/lookup/__pycache__/vars.cpython-39.pyc
a

�)g�
�@s`ddlmZmZmZeZdZdZdZddl	m
Z
mZddlm
Z
ddlmZGdd	�d	e�Zd
S)�)�absolute_import�division�print_functiona
    name: vars
    author: Ansible Core Team
    version_added: "2.5"
    short_description: Lookup templated value of variables
    description:
      - 'Retrieves the value of an Ansible variable. Note: Only returns top level variable names.'
    options:
      _terms:
        description: The variable names to look up.
        required: True
      default:
        description:
            - What to return if a variable is undefined.
            - If no default is set, it will result in an error if any of the variables is undefined.
a�
- name: Show value of 'variablename'
  ansible.builtin.debug: msg="{{ lookup('ansible.builtin.vars', 'variabl' + myvar) }}"
  vars:
    variablename: hello
    myvar: ename

- name: Show default empty since i dont have 'variablnotename'
  ansible.builtin.debug: msg="{{ lookup('ansible.builtin.vars', 'variabl' + myvar, default='')}}"
  vars:
    variablename: hello
    myvar: notename

- name: Produce an error since i dont have 'variablnotename'
  ansible.builtin.debug: msg="{{ lookup('ansible.builtin.vars', 'variabl' + myvar)}}"
  ignore_errors: True
  vars:
    variablename: hello
    myvar: notename

- name: find several related variables
  ansible.builtin.debug: msg="{{ lookup('ansible.builtin.vars', 'ansible_play_hosts', 'ansible_play_batch', 'ansible_play_hosts_all') }}"

- name: Access nested variables
  ansible.builtin.debug: msg="{{ lookup('ansible.builtin.vars', 'variabl' + myvar).sub_var }}"
  ignore_errors: True
  vars:
    variablename:
        sub_var: 12
    myvar: ename

- name: alternate way to find some 'prefixed vars' in loop
  ansible.builtin.debug: msg="{{ lookup('ansible.builtin.vars', 'ansible_play_' + item) }}"
  loop:
    - hosts
    - batch
    - hosts_all
z]
_value:
  description:
    - value of the variables requested.
  type: list
  elements: raw
)�AnsibleError�AnsibleUndefinedVariable)�string_types)�
LookupBasec@seZdZddd�ZdS)�LookupModuleNc	Ks|dur||j_t|jdi�}|j||d�|�d�}g}|D]�}t|t�s`td|t|�f��zrz||}WnJt	y�z|d|d|}Wnt	y�t
d|��Yn0Yn0|�|jj|dd	��Wq>t
y�|dur�|�|�n�Yq>0q>|S)
NZ_available_variables)Zvar_optionsZdirect�defaultz:Invalid setting identifier, "%s" is not a string, its a %sZhostvarsZinventory_hostnamez$No variable found with this name: %sT)Zfail_on_undefined)
Z_templarZavailable_variables�getattrZset_optionsZ
get_option�
isinstancerr�type�KeyErrorr�append�template)	�selfZtermsZ	variables�kwargsZmyvarsr
�retZterm�value�r�?/usr/lib/python3.9/site-packages/ansible/plugins/lookup/vars.py�runMs.


zLookupModule.run)N)�__name__�
__module__�__qualname__rrrrrr	Ksr	N)Z
__future__rrrr
Z
__metaclass__Z
DOCUMENTATIONZEXAMPLESZRETURNZansible.errorsrrZansible.module_utils.sixrZansible.plugins.lookuprr	rrrr�<module>s'