ansible.builtin.xattr (v2.4.3.0-1) — module

set/retrieve extended attributes

| "added in version" 1.3 of ansible.builtin"

Authors: Brian Coca (@bcoca)

stableinterface | supported by community

Install Ansible via pip

Install with pip install ansible==2.4.3.0.post1

Description

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

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Obtain the extended attributes  of /etc/foo.conf
- xattr:
    path: /etc/foo.conf
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Sets the key 'foo' to value 'bar'
- xattr:
    path: /etc/foo.conf
    key: user.foo
    value: bar
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Removes the key 'foo'
- xattr:
    path: /etc/foo.conf
    key: user.foo
    state: absent

Inputs

    
key:
    default: None
    description:
    - The name of a specific Extended attribute key to set/retrieve
    required: false

path:
    aliases:
    - name
    default: None
    description:
    - The full path of the file/object to get the facts of.
    - Before 2.3 this option was only usable as I(name).
    required: true

state:
    choices:
    - read
    - present
    - all
    - keys
    - absent
    default: read
    description:
    - defines which state you want to do. C(read) retrieves the current value for a C(key)
      (default) C(present) sets C(name) to C(value), default if value is set C(all) dumps
      all data C(keys) retrieves all keys C(absent) deletes the key
    required: false

value:
    default: None
    description:
    - The value to set the named name/key to, it automatically sets the C(state) to 'set'
    required: false

follow:
    choices:
    - 'yes'
    - 'no'
    default: true
    description:
    - if yes, dereferences symlinks and sets/gets attributes on symlink target, otherwise
      acts on symlink itself.
    required: false