Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /lib/python3.11/site-packages/ansible/plugins/lookup/__pycache__/ |
Upload File : |
� ���c� � � � d dl mZmZmZ eZdZdZdZd dl m Z mZ d dlm Z d dlmZ d dlmZ e� � Z G d � d e � � ZdS )� )�absolute_import�division�print_functiona� 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. aF - 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�AnsibleParserError)� LookupBase)�to_text)�Displayc � � e Zd Zdd�ZdS )�LookupModuleNc �t � g }| � ||�� � |D �]}t � d|z � � | � |d|� � }t � d|z � � |r�| j � |� � \ }}t |d�� � } | � d� � r| � � � } | � d� � r| � � � } |� | � � nt � � ���# t $ r t d |z � � �w xY w|S ) N)�var_options�directzFile lookup term: %s�fileszFile lookup using %s as file�surrogate_or_strict)�errors�lstrip�rstripz#could not locate file in lookup: %s)�set_options�display�debug�find_file_in_search_path�vvvv�_loader�_get_file_contentsr � get_optionr r �appendr r ) �self�terms� variables�kwargs�ret�term� lookupfile� b_contents� show_data�contentss �@/usr/lib/python3.11/site-packages/ansible/plugins/lookup/file.py�runzLookupModule.run? s] � ������Y�v��>�>�>�� Q� Q�D��M�M�0�4�7�8�8�8� �6�6�y�'�4�P�P�J��L�L�8�:�E�F�F�F� Q�� /�,0�L�,K�,K�J�,W�,W�)�J� �&�z�:O�P�P�P�H����x�0�0� 5�#+�?�?�#4�#4�����x�0�0� 5�#+�?�?�#4�#4���J�J�x�(�(�(�(�,�.�.�.� )�� &� Q� Q� Q�"�#H�4�#O�P�P�P� Q���� � s �1B&D�D5)N)�__name__� __module__�__qualname__r) � � r( r r = s( � � � � � �� � � � � r. r N)� __future__r r r �type� __metaclass__� DOCUMENTATION�EXAMPLES�RETURN�ansible.errorsr r �ansible.plugins.lookupr �ansible.module_utils._textr �ansible.utils.displayr r r r- r. r( �<module>r9 s� �� C� B� B� B� B� B� B� B� B� B�� �� �4 �� �� <� ;� ;� ;� ;� ;� ;� ;� -� -� -� -� -� -� .� .� .� .� .� .� )� )� )� )� )� )� �'�)�)��� � � � �:� � � � � r.