stat

Collection: builtin

Full Name: parallax.builtin.stat

Aliases: ansible.builtin.stat, stat

Synopsis

Retrieve metadata about a file, directory or device

Parameters

NameTypeRequiredDefaultDescription
pathstringyesThe full path of the file/directory to get facts about
followboolfalseWhether to follow symbolic links
get_checksumbooltrueWhether to calculate checksum for files
checksum_algorithmstringsha1Algorithm to use for checksum
get_mimebooltrueUse file magic and return data about the nature of the file
get_attributesbooltrueGet file attributes using lsattr tool

Example

- name: Check whether the certificate is already in place
  stat:
    path: /etc/ssl/certs/app.pem
    get_checksum: true
  register: cert