| 1 |
# -*- coding: utf-8 -*- |
| 2 |
|
| 3 |
# Copyright: (c) 2014, Matt Martz <[email protected]> |
| 4 |
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) |
| 5 |
from __future__ import annotations |
| 6 |
|
| 7 |
|
| 8 |
class ModuleDocFragment(object): |
| 9 |
|
| 10 |
# Standard files documentation fragment |
| 11 |
|
| 12 |
# Note: mode is overridden by the copy and template modules so if you change the description |
| 13 |
# here, you should also change it there. |
| 14 |
DOCUMENTATION = r""" |
| 15 |
options: |
| 16 |
mode: |
| 17 |
description: |
| 18 |
- The permissions the resulting filesystem object should have. |
| 19 |
- For those used to C(/usr/bin/chmod) remember that modes are actually octal numbers. |
| 20 |
You must give Ansible enough information to parse them correctly. |
| 21 |
For consistent results, quote octal numbers (for example, V('644') or V('1777')) so Ansible receives |
| 22 |
a string and can do its own conversion from string into number. |
| 23 |
Adding a leading zero (for example, V(0755)) works sometimes, but can fail in loops and some other circumstances. |
| 24 |
- Giving Ansible a number without following either of these rules will end up with a decimal |
| 25 |
number which will have unexpected results. |
| 26 |
- As of Ansible 1.8, the mode may be specified as a symbolic mode (for example, V(u+rwx) or |
| 27 |
V(u=rw,g=r,o=r)). |
| 28 |
- If O(mode) is not specified and the destination filesystem object B(does not) exist, the default C(umask) on the system will be used |
| 29 |
when setting the mode for the newly created filesystem object. |
| 30 |
- If O(mode) is not specified and the destination filesystem object B(does) exist, the mode of the existing filesystem object will be used. |
| 31 |
- Specifying O(mode) is the best way to ensure filesystem objects are created with the correct permissions. |
| 32 |
See CVE-2020-1736 for further details. |
| 33 |
type: raw |
| 34 |
owner: |
| 35 |
description: |
| 36 |
- Name of the user that should own the filesystem object, as would be fed to C(chown). |
| 37 |
- When left unspecified, it uses the current user unless you are root, in which |
| 38 |
case it can preserve the previous ownership. |
| 39 |
- Specifying a numeric username (for example, "1000") will be assumed to be a user ID (UID) and not a username. |
| 40 |
To prevent confusion, avoid using purely numeric usernames. |
| 41 |
|
| 42 |
type: str |
| 43 |
group: |
| 44 |
description: |
| 45 |
- Name of the group that should own the filesystem object, as would be fed to C(chown). |
| 46 |
- When left unspecified, it uses the current group of the current user unless you are root, |
| 47 |
in which case it can preserve the previous ownership. |
| 48 |
- Specifying a numeric group name (for example, "1000") will be assumed to be a group ID (GID) and not a group name. |
| 49 |
To prevent confusion, avoid using purely numeric group names. |
| 50 |
type: str |
| 51 |
seuser: |
| 52 |
description: |
| 53 |
- The user part of the SELinux filesystem object context. |
| 54 |
- By default it uses the V(system) policy, where applicable. |
| 55 |
- When set to V(_default), it will use the C(user) portion of the policy if available. |
| 56 |
type: str |
| 57 |
serole: |
| 58 |
description: |
| 59 |
- The role part of the SELinux filesystem object context. |
| 60 |
- When set to V(_default), it will use the C(role) portion of the policy if available. |
| 61 |
type: str |
| 62 |
setype: |
| 63 |
description: |
| 64 |
- The type part of the SELinux filesystem object context. |
| 65 |
- When set to V(_default), it will use the C(type) portion of the policy if available. |
| 66 |
type: str |
| 67 |
selevel: |
| 68 |
description: |
| 69 |
- The level part of the SELinux filesystem object context. |
| 70 |
- This is the MLS/MCS attribute, sometimes known as the C(range). |
| 71 |
- When set to V(_default), it will use the C(level) portion of the policy if available. |
| 72 |
type: str |
| 73 |
unsafe_writes: |
| 74 |
description: |
| 75 |
- Influence when to use atomic operation to prevent data corruption or inconsistent reads from the target filesystem object. |
| 76 |
- By default this module uses atomic operations to prevent data corruption or inconsistent reads from the target filesystem objects, |
| 77 |
but sometimes systems are configured or just broken in ways that prevent this. One example is docker mounted filesystem objects, |
| 78 |
which cannot be updated atomically from inside the container and can only be written in an unsafe manner. |
| 79 |
- This option allows Ansible to fall back to unsafe methods of updating filesystem objects when atomic operations fail |
| 80 |
(however, it doesn't force Ansible to perform unsafe writes). |
| 81 |
- IMPORTANT! Unsafe writes are subject to race conditions and can lead to data corruption. |
| 82 |
type: bool |
| 83 |
default: no |
| 84 |
version_added: '2.2' |
| 85 |
attributes: |
| 86 |
description: |
| 87 |
- The attributes the resulting filesystem object should have. |
| 88 |
- To get supported flags look at the man page for C(chattr) on the target system. |
| 89 |
- This string should contain the attributes in the same order as the one displayed by C(lsattr). |
| 90 |
- The C(=) operator is assumed as default, otherwise C(+) or C(-) operators need to be included in the string. |
| 91 |
type: str |
| 92 |
aliases: [ attr ] |
| 93 |
version_added: '2.3' |
| 94 |
""" |