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 : |
� ���cN � �� � d dl mZmZmZ eZdZdZdZd dl m Z d dlZd dlm Z d dlmZ d dlmZ d d lmZmZ d d lmZmZ d dlmZ d dlmZ e� � Z G d � de� � ZdS )� )�absolute_import�division�print_functiona� name: template author: Michael DeHaan version_added: "0.9" short_description: retrieve contents of file after templating with Jinja2 description: - Returns a list of strings; for each template in the list of templates you pass in, returns a string containing the results of processing that template. options: _terms: description: list of files to template convert_data: type: bool description: - Whether to convert YAML into data. If False, strings that are YAML will be left untouched. - Mutually exclusive with the jinja2_native option. default: true variable_start_string: description: The string marking the beginning of a print statement. default: '{{' version_added: '2.8' type: str variable_end_string: description: The string marking the end of a print statement. default: '}}' version_added: '2.8' type: str jinja2_native: description: - Controls whether to use Jinja2 native types. - It is off by default even if global jinja2_native is True. - Has no effect if global jinja2_native is False. - This offers more flexibility than the template module which does not use Jinja2 native types at all. - Mutually exclusive with the convert_data option. default: False version_added: '2.11' type: bool template_vars: description: A dictionary, the keys become additional variables available for templating. default: {} version_added: '2.3' type: dict comment_start_string: description: The string marking the beginning of a comment statement. version_added: '2.12' type: str comment_end_string: description: The string marking the end of a comment statement. version_added: '2.12' type: str aO - name: show templating results ansible.builtin.debug: msg: "{{ lookup('ansible.builtin.template', './some_template.j2') }}" - name: show templating results with different variable start and end string ansible.builtin.debug: msg: "{{ lookup('ansible.builtin.template', './some_template.j2', variable_start_string='[%', variable_end_string='%]') }}" - name: show templating results with different comment start and end string ansible.builtin.debug: msg: "{{ lookup('ansible.builtin.template', './some_template.j2', comment_start_string='[#', comment_end_string='#]') }}" zW _raw: description: file(s) content after templating type: list elements: raw )�deepcopyN)�AnsibleError)� LookupBase)�to_bytes�to_text)�generate_ansible_template_vars�AnsibleEnvironment)�Display)�NativeJinjaTextc � � e Zd Zd� ZdS )�LookupModulec �� � g }| � ||�� � | � d� � }| � d� � }| � d� � ot j }| � d� � }| � d� � } | � d� � } | � d� � }|r| j }n | j � t � � � }|D �]�} t � d | z � � | � |d| � � }t � d|z � � |�r�| j � |� � \ }}t |d �� � }|� dg � � }|rQg }|D ]J}|� t j � |d� � � � |� |� � �K|}|� dt j � |� � � � t+ |� � }|� t/ | |� � � � |� |� � |� || | |||�� � 5 |� |d|d�� � }d d d � � n# 1 swxY w Y t j r|r|st5 |� � }|� |� � ���t7 d| z � � �|S )N)�var_options�direct�convert_data� template_vars� jinja2_native�variable_start_string�variable_end_string�comment_start_string�comment_end_string)�environment_classzFile lookup term: %s� templateszFile lookup using %s as file�surrogate_or_strict)�errors�ansible_search_pathr )r r r r �available_variables� searchpathTF)�preserve_trailing_newlinesr �escape_backslashesz6the template file %s could not be found for the lookup)�set_options� get_option�C�DEFAULT_JINJA2_NATIVE�_templar�copy_with_new_envr �display�debug�find_file_in_search_path�vvvv�_loader�_get_file_contentsr �get�append�os�path�join�insert�dirnamer �updater �set_temporary_context�templater r )�self�terms� variables�kwargs�ret�convert_data_p�lookup_template_varsr r r r r �templar�term� lookupfile�b_template_data� show_data� template_datar! � newsearchpath�p�vars�ress �D/usr/lib/python3.11/site-packages/ansible/plugins/lookup/template.py�runzLookupModule.runb sM � ������Y�v��>�>�>� ����8�8��#����?�?������8�8�T�Q�=T� � $���0G� H� H��"�o�o�.C�D�D��#���/E�F�F��!�_�_�-A�B�B��� \��m�G�G��m�5�5�HZ�5�[�[�G�� - d� - d�D��M�M�0�4�7�8�8�8��6�6�y�+�t�T�T�J��L�L�7�*�D�E�E�E�� ( d�-1�\�-L�-L�Z�-X�-X�*��� '��@U� V� V� V� � '�]�]�+@�"�E�E� �� /� %'�M�'� 0� 0��%�,�,�R�W�\�\�!�[�-I�-I�J�J�J�%�,�,�Q�/�/�/�/�!.�J��!�!�!�R�W�_�_�Z�%@�%@�A�A�A� � �*�*�����:�4��L�L�M�M�M����0�1�1�1��2�2�I^�GZ�H\�FX�GK�Xb� 3� d� d� b� b� "�*�*�=�UY�8F�[`� +� b� b�C�b� b� b� b� b� b� b� b� b� b� b���� b� b� b� b� �+� /�M� /�.� /� *�#�.�.�C�� � �3�����"�#[�^b�#b�c�c�c�� s �(J�J �J N)�__name__� __module__�__qualname__rL � � rK r r ` s( � � � � � �C� C� C� C� CrQ r )� __future__r r r �type� __metaclass__� DOCUMENTATION�EXAMPLES�RETURN�copyr r2 �ansible.constants� constantsr&