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: file.cpython-310.pyc
o O�h� � @ sj d dl mZ dZdZdZd dlmZmZmZ d dl m Z d dlmZ d dl mZ e� ZG d d � d e �ZdS )� )�annotationsa� name: file author: Daniel Hokka Zakrisson (!UNKNOWN) <daniel@hozac.com> version_added: "0.9" short_description: read file contents description: - This lookup returns the contents from a file on the Ansible controller's file system. options: _terms: description: path(s) of files to read required: True rstrip: description: whether or not to remove whitespace from the ending of the looked-up file type: bool required: False default: True lstrip: description: whether or not to remove whitespace from the beginning of the looked-up file type: bool required: False default: False notes: - if read in variable context, the file can be interpreted as YAML if the content is valid to the parser. - this lookup does not understand 'globbing', use the fileglob lookup instead. seealso: - ref: playbook_task_paths description: Search paths used for relative files. aG - ansible.builtin.debug: msg: "the value of foo.txt is {{ lookup('ansible.builtin.file', '/etc/foo.txt') }}" - name: display multiple file contents ansible.builtin.debug: var=item with_file: - "/path/to/foo.txt" - "bar.txt" # will be looked in files/ dir relative to play or in role - "/path/to/biz.txt" zV _raw: description: - content of file(s) type: list elements: str )�AnsibleError�AnsibleOptionsError�AnsibleLookupError)� LookupBase)�to_text)�Displayc @ s e Zd Zddd�ZdS )�LookupModuleNc K s� g }| j ||d� |D ][}t�d| � z>| j|d|dd�}t�d| � |rM| j�|�\}}t|dd�} | �d �r>| � � } | �d �rG| � � } |�| � ntd��W q t yf } ztd| | d ��d } ~ ww |S )N)�var_options�directzFile lookup term: %s�filesT)�ignore_missingzFile lookup using %s as file�surrogate_or_strict)�errors�lstrip�rstripz0file not found, use -vvvvv to see paths searchedz6The 'file' lookup had an issue accessing the file '%s')�orig_exc)�set_options�display�debug�find_file_in_search_path�vvvv�_loader�_get_file_contentsr � get_optionr r �appendr r r )�self�terms� variables�kwargs�ret�term� lookupfile� b_contents� show_data�contents�e� r'