xattr - set/retrieve extended attributes

New in version 1.3.


Manages filesystem user defined extended attributes, requires that they are enabled on the target filesystem and that the setfattr/getfattr utilities are present.


parameter required default choices comments
no True
  • yes
  • no
if yes, dereferences symlinks and sets/gets attributes on symlink target, otherwise acts on symlink itself.
no None
The name of a specific Extended attribute key to set/retrieve
yes None
The full path of the file/object to get the facts of
aliases: path
no get
  • read
  • present
  • all
  • keys
  • absent
defines which state you want to do. read retrieves the current value for a key (default) present sets name to value, default if value is set all dumps all data keys retrieves all keys absent deletes the key
no None
The value to set the named name/key to, it automatically sets the state to 'set'


# Obtain the extended attributes  of /etc/foo.conf
- xattr: name=/etc/foo.conf

# Sets the key 'foo' to value 'bar'
- xattr: path=/etc/foo.conf key=user.foo value=bar

# Removes the key 'foo'
- xattr: name=/etc/foo.conf key=user.foo state=absent

This is a Core Module

For more information on what this means please read Core Modules

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, developing_test_pr and Developing Modules.

© 2012–2016 Michael DeHaan
© 2016 Red Hat, Inc.
Licensed under the GNU General Public License version 3.