community.general.xattr_info module – Retrieve filesystem extended attributes
Note
This module is part of the community.general collection (version 14.0.0).
You might already have this collection installed if you are using the ansible package.
It is not included in ansible-core.
To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install community.general.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: community.general.xattr_info.
New in community.general 14.0.0
Synopsis
Retrieves filesystem extended attributes of a file or directory, with the help of
getfattr.Requires that extended attributes are enabled on the target filesystem.
Requirements
The below requirements are needed on the host that executes this module.
getfattr
Parameters
Parameter |
Comments |
|---|---|
If Choices:
|
|
The name of a specific extended attribute to retrieve. The value of If not set, all the extended attributes in |
|
Namespace of the extended attributes. When Default: |
|
The full path of the file or directory to retrieve the extended attributes from. |
Attributes
Attribute |
Support |
Description |
|---|---|---|
Support: full This action does not modify state. |
Can run in |
|
Support: N/A This action does not modify state. |
Returns details on what has changed (or possibly needs changing in |
See Also
See also
- community.general.xattr
Manage user defined extended attributes.
- C(getfattr) command manual page
Manual page for the command.
Examples
- name: Obtain the extended attributes of /etc/foo.conf
community.general.xattr_info:
path: /etc/foo.conf
register: result
- name: List the names of the extended attributes of /etc/foo.conf
ansible.builtin.debug:
msg: "{{ result.xattr.keys() }}"
- name: Obtain the value of the key 'user.foo'
community.general.xattr_info:
path: /etc/foo.conf
key: foo
register: result
- name: Obtain the value of the key 'trusted.glusterfs.volume-id'
community.general.xattr_info:
path: /mnt/bricks/brick1
namespace: trusted
key: glusterfs.volume-id
register: result
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
The extended attributes, mapping their full names to their values. Text values are returned without the surrounding quotes, binary values are returned encoded as by When Returned: success Sample: |