I’ve got a set of systems that have a configuration file with the “immutable” flag set on them by a previous setup process. The “lsattr /etc/security/access.conf” on a RHEL 6 system shows the “i” flag set. Manually doing a “chattr -i /etc/security/access.conf” removes the flag, but I’d like to have Ansible remove this flag if found on a few of these files.
The documentation isn’t clear on what “attributes” can be but the file module call chattr with the “=” precursor before the attributes. For my case, I can just send “e” as the attribute (which effectively removes “i”, the only attribute on this file usually), but it doesn’t make it easy to enforce a single change without knowing and setting all attributes. (Admittedly that would be more idempotent.)
Can someone update the the documentation, to add this note on the usage?
Or, can the command line fed to chattr be updated to remove the “=” before the attributes when a +/- is present in the attributes line? That makes it easy to use “-i” to remove immutable, or “+i” to add immutable flag, though I haven’t thought through the ramifications and idempotent features…
The documentation isn't clear on what "attributes" can be but the file
module call chattr with the "=" precursor before the attributes. For my
case, I can just send "e" as the attribute (which effectively removes "i",
the only attribute on this file usually), but it doesn't make it easy to
enforce a single change without knowing and setting all attributes.
(Admittedly that would be more idempotent.)
It only require an additional task to only remove the attribute without touching the other ones.
- stat:
path: /etc/security/access.conf
register: result
Can someone update the the documentation, to add this note on the usage?
Or, can the command line fed to chattr be updated to remove the "=" before
the attributes when a +/- is present in the attributes line? That makes it
easy to use "-i" to remove immutable, or "+i" to add immutable flag, though
I haven't thought through the ramifications and idempotent features...