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: //usr/lib/python3.9/site-packages/ansible/plugins/lookup/__pycache__/config.cpython-39.pyc
a

�)g�@s�ddlmZmZmZeZdZdZdZddl	m
mZddl
mZddlmZmZmZddlmZdd	lmZdd
lmZddlmZGdd
�d
e�Zdd�Zdd�ZGdd�de�ZdS)�)�absolute_import�division�print_functiona�
    name: config
    author: Ansible Core Team
    version_added: "2.5"
    short_description: Lookup current Ansible configuration values
    description:
      - Retrieves the value of an Ansible configuration setting.
      - You can use C(ansible-config list) to see all available settings.
    options:
      _terms:
        description: The key(s) to look up
        required: True
      on_missing:
        description:
            - action to take if term is missing from config
            - Error will raise a fatal error
            - Skip will just ignore the term
            - Warn will skip over it but issue a warning
        default: error
        type: string
        choices: ['error', 'skip', 'warn']
      plugin_type:
        description: the type of the plugin referenced by 'plugin_name' option.
        choices: ['become', 'cache', 'callback', 'cliconf', 'connection', 'httpapi', 'inventory', 'lookup', 'netconf', 'shell', 'vars']
        type: string
        version_added: '2.12'
      plugin_name:
        description: name of the plugin for which you want to retrieve configuration settings.
        type: string
        version_added: '2.12'
a

    - name: Show configured default become user
      ansible.builtin.debug: msg="{{ lookup('ansible.builtin.config', 'DEFAULT_BECOME_USER')}}"

    - name: print out role paths
      ansible.builtin.debug:
        msg: "These are the configured role paths: {{lookup('ansible.builtin.config', 'DEFAULT_ROLES_PATH')}}"

    - name: find retry files, skip if missing that key
      ansible.builtin.find:
        paths: "{{lookup('ansible.builtin.config', 'RETRY_FILES_SAVE_PATH')|default(playbook_dir, True)}}"
        patterns: "*.retry"

    - name: see the colors
      ansible.builtin.debug: msg="{{item}}"
      loop: "{{lookup('ansible.builtin.config', 'COLOR_OK', 'COLOR_CHANGED', 'COLOR_SKIP', wantlist=True)}}"

    - name: skip if bad value in var
      ansible.builtin.debug: msg="{{ lookup('ansible.builtin.config', config_in_var, on_missing='skip')}}"
      var:
        config_in_var: UNKNOWN

    - name: show remote user and port for ssh connection
      ansible.builtin.debug: msg={{q("ansible.builtin.config", "remote_user", "port", plugin_type="connection", plugin_name="ssh", on_missing='skip')}}

    - name: show remote_tmp setting for shell (sh) plugin
      ansible.builtin.debug: msg={{q("ansible.builtin.config", "remote_tmp", plugin_type="shell", plugin_name="sh")}}
zM
_raw:
  description:
    - value(s) of the key(s) in the config
  type: raw
N)�	constants)�AnsibleError�AnsibleLookupError�AnsibleOptionsError)�	to_native)�string_types)�
LookupBase)�Sentinelc@seZdZdS)�MissingSettingN)�__name__�
__module__�__qualname__�rr�A/usr/lib/python3.9/site-packages/ansible/plugins/lookup/config.pyr
Tsr
c	
Cs�zNttd|�}|j|dd�}|dur6td||f��tjj|||j|d�}WnVtyb�YnDty�}z,t	|�}d|vr�t
||d��|�WYd}~n
d}~00|S)Nz	%s_loaderT)Z
class_onlyzUnable to load %s plugin "%s")�plugin_type�plugin_name�	variableszwas not defined�Zorig_exc)�getattr�
plugin_loader�getr�C�configZget_config_valueZ
_load_namerr	r
)	�pname�ptyperr�loader�p�result�e�msgrrr�_get_plugin_configXsr#c
Cs\z"tt|�}t|�r td|��Wn4tyV}ztt|�|d��WYd}~n
d}~00|S)NzInvalid setting "%s" attemptedr)rr�callabler�AttributeErrorr
r	)rr r!rrr�_get_global_configks
&r&c@seZdZddd�ZdS)�LookupModuleNcKs,|j||d�|�d�}|�d�}|�d�}|s4|rD|r<|sDtd��t|t�rV|dvrbtd|��g}|D]�}t|t�s�td|t|�f��t}	z |r�t||||�}	nt|�}	Wnbt	�y}
zH|d	kr�t
d
||
d��n"|dkr�|j�d
|�n|dkr�WYd}
~
n
d}
~
00|	turj|�
|	�qj|S)N)Zvar_optionsZdirectZ
on_missingrrzOBoth plugin_type and plugin_name are required, cannot use one without the other)�error�warn�skipzJ"on_missing" must be a string and one of "error", "warn" or "skip", not %sz:Invalid setting identifier, "%s" is not a string, its a %sr(zUnable to find setting %srr)z!Skipping, did not find setting %sr*)Zset_optionsZ
get_optionr�
isinstancer
�typerr#r&r
rZ_displayZwarning�append)�selfZtermsr�kwargs�missingrr�retZtermr r!rrr�runxs6



zLookupModule.run)N)rrrr2rrrrr'vsr') Z
__future__rrrr,Z
__metaclass__Z
DOCUMENTATIONZEXAMPLESZRETURNZansible.plugins.loaderZpluginsrrZansiblerrZansible.errorsrrrZansible.module_utils._textr	Zansible.module_utils.sixr
Zansible.plugins.lookuprZansible.utils.sentinelrr
r#r&r'rrrr�<module>s