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/modules/__pycache__/ |
Upload File : |
� ���cpN � � � d dl mZmZmZ eZdZdZdZd dl Z d dl Z d dlZd dlZd dl Z d dlmZ d dlmZ d� Zd � Zed k r e� � dS dS )� )�absolute_import�division�print_functiona --- module: stat version_added: "1.3" short_description: Retrieve file or file system status description: - Retrieves facts for a file similar to the Linux/Unix 'stat' command. - For Windows targets, use the M(ansible.windows.win_stat) module instead. options: path: description: - The full path of the file/object to get the facts of. type: path required: true aliases: [ dest, name ] follow: description: - Whether to follow symlinks. type: bool default: no get_checksum: description: - Whether to return a checksum of the file. type: bool default: yes version_added: "1.8" checksum_algorithm: description: - Algorithm to determine checksum of file. - Will throw an error if the host is unable to use specified algorithm. - The remote host has to support the hashing method specified, C(md5) can be unavailable if the host is FIPS-140 compliant. type: str choices: [ md5, sha1, sha224, sha256, sha384, sha512 ] default: sha1 aliases: [ checksum, checksum_algo ] version_added: "2.0" get_mime: description: - Use file magic and return data about the nature of the file. this uses the 'file' utility found on most Linux/Unix systems. - This will add both C(mime_type) and C(charset) fields to the return, if possible. - In Ansible 2.3 this option changed from I(mime) to I(get_mime) and the default changed to C(true). type: bool default: yes aliases: [ mime, mime_type, mime-type ] version_added: "2.1" get_attributes: description: - Get file attributes using lsattr tool if present. type: bool default: yes aliases: [ attr, attributes ] version_added: "2.3" extends_documentation_fragment: - action_common_attributes attributes: check_mode: support: full diff_mode: support: none platform: platforms: posix seealso: - module: ansible.builtin.file - module: ansible.windows.win_stat author: Bruce Pennypacker (@bpennypacker) a� # Obtain the stats of /etc/foo.conf, and check that the file still belongs # to 'root'. Fail otherwise. - name: Get stats of a file ansible.builtin.stat: path: /etc/foo.conf register: st - name: Fail if the file does not belong to 'root' ansible.builtin.fail: msg: "Whoops! file ownership has changed" when: st.stat.pw_name != 'root' # Determine if a path exists and is a symlink. Note that if the path does # not exist, and we test sym.stat.islnk, it will fail with an error. So # therefore, we must test whether it is defined. # Run this to understand the structure, the skipped ones do not pass the # check performed by 'when' - name: Get stats of the FS object ansible.builtin.stat: path: /path/to/something register: sym - name: Print a debug message ansible.builtin.debug: msg: "islnk isn't defined (path doesn't exist)" when: sym.stat.islnk is not defined - name: Print a debug message ansible.builtin.debug: msg: "islnk is defined (path must exist)" when: sym.stat.islnk is defined - name: Print a debug message ansible.builtin.debug: msg: "Path exists and is a symlink" when: sym.stat.islnk is defined and sym.stat.islnk - name: Print a debug message ansible.builtin.debug: msg: "Path exists and isn't a symlink" when: sym.stat.islnk is defined and sym.stat.islnk == False # Determine if a path exists and is a directory. Note that we need to test # both that p.stat.isdir actually exists, and also that it's set to true. - name: Get stats of the FS object ansible.builtin.stat: path: /path/to/something register: p - name: Print a debug message ansible.builtin.debug: msg: "Path exists and is a directory" when: p.stat.isdir is defined and p.stat.isdir - name: Do not calculate the checksum ansible.builtin.stat: path: /path/to/myhugefile get_checksum: no - name: Use sha256 to calculate the checksum ansible.builtin.stat: path: /path/to/something checksum_algorithm: sha256 a�&