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 Z d dl Z d dlmZ d dl mZ d dlmZmZ G d � d e� � ZdS )� )�absolute_import�division�print_functionad name: fileglob author: Michael DeHaan version_added: "1.4" short_description: list files matching a pattern description: - Matches all files in a single directory, non-recursively, that match a pattern. It calls Python's "glob" library. options: _terms: description: path(s) of files to read required: True notes: - Patterns are only supported on files, not directory/paths. - See R(Ansible task paths,playbook_task_paths) to understand how file lookup occurs with paths. - Matching is against local system files on the Ansible controller. To iterate a list of files on a remote node, use the M(ansible.builtin.find) module. - Returns a string list of paths joined by commas, or an empty list if no files match. For a 'true list' pass C(wantlist=True) to the lookup. a_ - name: Display paths of all .txt files in dir ansible.builtin.debug: msg={{ lookup('ansible.builtin.fileglob', '/my/path/*.txt') }} - name: Copy each file over that matches the given pattern ansible.builtin.copy: src: "{{ item }}" dest: "/etc/fooapp/" owner: "root" mode: 0600 with_fileglob: - "/playbooks/files/fooapp/*" zS _list: description: - list of files type: list elements: path N)� LookupBase)�AnsibleFileNotFound)�to_bytes�to_textc � � e Zd Zdd�ZdS )�LookupModuleNc � � g }|D �]O}t j � |� � }g }||k rH|� | � |dt j � |� � � � � � npd|v r |d }n| � |� � g}|D ]J} |� t j � | d� � � � |� | � � �K|D ]j} | rft j t t j � | |� � d�� � � � }d� |D � � }|r|� |� � n�k��Q|S )N�files�ansible_search_path�surrogate_or_strict��errorsc �n � g | ]2}t j � |� � �!t |d �� � ��3S )r r )�os�path�isfiler )�.0�gs �D/usr/lib/python3.11/site-packages/ansible/plugins/lookup/fileglob.py� <listcomp>z$LookupModule.run.<locals>.<listcomp>P s? � �#s�#s�#s�QR�ac�ah�ao�ao�pq�ar�ar�#s�G�A�6K�$L�$L�$L�#s�#s�#s� )r r �basename�append�find_file_in_search_path�dirname�get_basedir�join�globr �extend) �self�terms� variables�kwargs�ret�term� term_file�found_paths�paths�p�dwimmed_path�globbed�term_resultss r �runzLookupModule.run; so � ���� � �D���(�(��.�.�I��K��D� � ��"�"�4�#@�#@��G�UW�U\�Ud�Ud�ei�Uj�Uj�#k�#k�l�l�l�l� )�I�5�5�%�&;�<�E�E�!�-�-�i�8�8�9�E�� *� *�A��&�&�r�w�|�|�A�w�'?�'?�@�@�@��&�&�q�)�)�)�)� +� � ��� �"�i������l�I�1V�1V�_t�(u�(u�(u�v�v�G�#s�#s�V]�#s�#s�#s�L�#� �� � �<�0�0�0������ r )N)�__name__� __module__�__qualname__r0 � r r r r 9 s( � � � � � �� � � � � r r )� __future__r r r �type� __metaclass__� DOCUMENTATION�EXAMPLES�RETURNr r! �ansible.plugins.lookupr �ansible.errorsr �ansible.module_utils._textr r r r4 r r �<module>r>