From 0c9ab06a558e103ee6d53eb1e902b4cf6431c94b Mon Sep 17 00:00:00 2001 From: Alexei Znamensky Date: Thu, 6 Jun 2024 22:56:16 +1200 Subject: [PATCH 1/2] review modules docs --- plugins/modules/acl.py | 18 ++++---- plugins/modules/at.py | 2 +- plugins/modules/authorized_key.py | 20 ++++----- plugins/modules/firewalld.py | 28 ++++++------ plugins/modules/firewalld_info.py | 2 +- plugins/modules/mount.py | 72 +++++++++++++++--------------- plugins/modules/patch.py | 16 +++---- plugins/modules/rhel_facts.py | 2 +- plugins/modules/rhel_rpm_ostree.py | 20 ++++----- plugins/modules/seboolean.py | 4 +- plugins/modules/selinux.py | 4 +- plugins/modules/synchronize.py | 59 ++++++++++++------------ plugins/modules/sysctl.py | 8 ++-- 13 files changed, 128 insertions(+), 127 deletions(-) diff --git a/plugins/modules/acl.py b/plugins/modules/acl.py index 1fde8eb..acde18b 100644 --- a/plugins/modules/acl.py +++ b/plugins/modules/acl.py @@ -25,7 +25,7 @@ options: state: description: - Define whether the ACL should be present or not. - - The C(query) state gets the current ACL without changing it, for use in C(register) operations. + - The V(query) state gets the current ACL without changing it, for use in C(register) operations. choices: [ absent, present, query ] default: query type: str @@ -36,8 +36,8 @@ options: default: true default: description: - - If the target is a directory, setting this to C(true) will make it the default ACL for entities created inside the directory. - - Setting C(default) to C(true) causes an error if the path is a file. + - If O(path) is a directory, setting this to V(true) will make it the default ACL for entities created inside the directory. + - Setting O(default=true) causes an error if O(path) is a file. type: bool default: false entity: @@ -53,7 +53,7 @@ options: permissions: description: - The permissions to apply/remove can be any combination of C(r), C(w), C(x) - - (read, write and execute respectively), and C(X) (execute permission if the file is a directory or already has execute permission for some user) + (read, write and execute respectively), and C(X) (execute permission if the file is a directory or already has execute permission for some user) type: str entry: description: @@ -67,8 +67,8 @@ options: recursive: description: - Recursively sets the specified ACL. - - Incompatible with C(state=query). - - Alias C(recurse) added in version 1.3.0. + - Incompatible with O(state=query). + - Alias O(recurse) added in version 1.3.0. type: bool default: false aliases: [ recurse ] @@ -81,7 +81,7 @@ options: description: - Select if and when to recalculate the effective right masks of the files. - See C(setfacl) documentation for more info. - - Incompatible with C(state=query). + - Incompatible with O(state=query). choices: [ default, mask, no_mask ] default: default type: str @@ -89,9 +89,9 @@ author: - Brian Coca (@bcoca) - Jérémie Astori (@astorije) notes: -- The C(acl) module requires that ACLs are enabled on the target filesystem and that the C(setfacl) and C(getfacl) binaries are installed. +- The M(ansible.posix.acl) module requires that ACLs are enabled on the target filesystem and that the C(setfacl) and C(getfacl) binaries are installed. - As of Ansible 2.0, this module only supports Linux distributions. -- As of Ansible 2.3, the I(name) option has been changed to I(path) as default, but I(name) still works as well. +- As of Ansible 2.3, the O(name) option has been changed to O(path) as default, but O(name) still works as well. ''' EXAMPLES = r''' diff --git a/plugins/modules/at.py b/plugins/modules/at.py index 3db953e..fefe6f2 100644 --- a/plugins/modules/at.py +++ b/plugins/modules/at.py @@ -36,7 +36,7 @@ options: choices: [ minutes, hours, days, weeks ] state: description: - - The state dictates if the command or script file should be evaluated as present(added) or absent(deleted). + - The state dictates if the command or script file should be evaluated as V(present)(added) or V(absent)(deleted). type: str choices: [ absent, present ] default: present diff --git a/plugins/modules/authorized_key.py b/plugins/modules/authorized_key.py index 26b5b0a..9fbc610 100644 --- a/plugins/modules/authorized_key.py +++ b/plugins/modules/authorized_key.py @@ -29,17 +29,17 @@ options: path: description: - Alternative path to the authorized_keys file. - - The default value is the C(.ssh/authorized_keys) of the home of the user specified in the O(user) parameter. - - Most of the time, it's not necessary to set this key. + - The default value is the V(.ssh/authorized_keys) of the home of the user specified in the O(user) parameter. + - Most of the time, it is not necessary to set this key. - Use the path to your target authorized_keys if you need to explicitly point on it. type: path manage_dir: description: - Whether this module should manage the directory of the authorized key file. - - If set to C(true), the module will create the directory, as well as set the owner and permissions + - If set to V(true), the module will create the directory, as well as set the owner and permissions of an existing directory. - - Be sure to set C(manage_dir=false) if you are using an alternate directory for authorized_keys, - as set with C(path), since you could lock yourself out of SSH access. + - Be sure to set O(manage_dir=false) if you are using an alternate directory for authorized_keys, + as set with O(path), since you could lock yourself out of SSH access. - See the example below. type: bool default: true @@ -56,17 +56,17 @@ options: exclusive: description: - Whether to remove all other non-specified keys from the authorized_keys file. - - Multiple keys can be specified in a single C(key) string value by separating them by newlines. + - Multiple keys can be specified in a single O(key) string value by separating them by newlines. - This option is not loop aware, so if you use C(with_) , it will be exclusive per iteration of the loop. - - If you want multiple keys in the file you need to pass them all to C(key) in a single batch as mentioned above. + - If you want multiple keys in the file you need to pass them all to O(key) in a single batch as mentioned above. type: bool default: false validate_certs: description: - This only applies if using a https url as the source of the keys. - - If set to C(false), the SSL certificates will not be validated. - - This should only set to C(false) used on personally controlled sites using self-signed certificates as it avoids verifying the source site. - - Prior to 2.1 the code worked as if this was set to C(true). + - If set to V(false), the SSL certificates will not be validated. + - This should only set to V(false) used on personally controlled sites using self-signed certificates as it avoids verifying the source site. + - Prior to 2.1 the code worked as if this was set to V(true). type: bool default: true comment: diff --git a/plugins/modules/firewalld.py b/plugins/modules/firewalld.py index 146990f..dc930ca 100644 --- a/plugins/modules/firewalld.py +++ b/plugins/modules/firewalld.py @@ -17,7 +17,7 @@ options: service: description: - Name of a service to add/remove to/from firewalld. - - The service must be listed in output of firewall-cmd --get-services. + - The service must be listed in output of C(firewall-cmd --get-services). type: str protocol: description: @@ -38,22 +38,22 @@ options: type: str required: true description: - - Source port to forward from + - Source port to forward from. proto: type: str required: true description: - - protocol to forward + - protocol to forward. choices: [udp, tcp] toport: type: str required: true description: - - destination port + - destination port. toaddr: type: str description: - - Optional address to forward to + - Optional address to forward to. rich_rule: description: - Rich rule to add/remove to/from firewalld. @@ -78,28 +78,28 @@ options: zone: description: - The firewalld zone to add/remove to/from. - - Note that the default zone can be configured per system but C(public) is default from upstream. + - Note that the default zone can be configured per system but V(public) is default from upstream. - Available choices can be extended based on per-system configs, listed here are "out of the box" defaults. - - Possible values include C(block), C(dmz), C(drop), C(external), C(home), C(internal), C(public), C(trusted), C(work). + - Possible values include V(block), V(dmz), V(drop), V(external), V(home), V(internal), V(public), V(trusted), V(work). type: str permanent: description: - Whether to apply this change to the permanent firewalld configuration. - As of Ansible 2.3, permanent operations can operate on firewalld configs when it is not running (requires firewalld >= 0.3.9). - - Note that if this is C(false), I(immediate) defaults to C(true). + - Note that if this is V(false), O(immediate=true). type: bool default: false immediate: description: - Whether to apply this change to the runtime firewalld configuration. - - Defaults to C(true) if I(permanent=false). + - Defaults to V(true) if O(permanent=false). type: bool default: false state: description: - Enable or disable a setting. - - 'For ports: Should this port accept (enabled) or reject (disabled) connections.' - - The states C(present) and C(absent) can only be used in zone level operations (i.e. when no other parameters but zone and state are set). + - 'For ports: Should this port accept (V(enabled)) or reject (V(disabled)) connections.' + - The states V(present) and V(absent) can only be used in zone level operations (i.e. when no other parameters but zone and state are set). type: str required: true choices: [ absent, disabled, enabled, present ] @@ -114,13 +114,13 @@ options: type: str offline: description: - - Ignores I(immediate) if I(permanent=true) and firewalld is not running. + - Ignores O(immediate) if O(permanent=true) and firewalld is not running. type: bool default: false target: description: - - firewalld Zone target - - If state is set to C(absent), this will reset the target to default + - firewalld Zone target. + - If O(state=absent), this will reset the target to default. choices: [ default, ACCEPT, DROP, "%%REJECT%%" ] type: str version_added: 1.2.0 diff --git a/plugins/modules/firewalld_info.py b/plugins/modules/firewalld_info.py index c83437d..c34a362 100644 --- a/plugins/modules/firewalld_info.py +++ b/plugins/modules/firewalld_info.py @@ -21,7 +21,7 @@ options: zones: description: - Gather information about specific zones. - - If only works if C(active_zones) is set to C(false). + - If only works if O(active_zones=false). required: false type: list elements: str diff --git a/plugins/modules/mount.py b/plugins/modules/mount.py index 318844b..4fdd826 100644 --- a/plugins/modules/mount.py +++ b/plugins/modules/mount.py @@ -24,20 +24,20 @@ options: path: description: - Path to the mount point (e.g. C(/mnt/files)). - - Before Ansible 2.3 this option was only usable as I(dest), I(destfile) and I(name). + - Before Ansible 2.3 this option was only usable as O(ignore:dest), O(ignore:destfile) and O(name). type: path required: true aliases: [ name ] src: description: - Device (or NFS volume, or something else) to be mounted on I(path). - - Required when I(state) set to C(present), C(mounted) or C(ephemeral). - - Ignored when I(state) set to C(absent) or C(unmounted). + - Required when O(state) set to V(present), V(mounted) or V(ephemeral). + - Ignored when O(state) set to V(absent) or V(unmounted). type: path fstype: description: - Filesystem type. - - Required when I(state) is C(present), C(mounted) or C(ephemeral). + - Required when O(state) is V(present), V(mounted) or V(ephemeral). type: str opts: description: @@ -46,53 +46,53 @@ options: dump: description: - Dump (see fstab(5)). - - Note that if set to C(null) and I(state) set to C(present), + - Note that if set to C(null) and O(state=present), it will cease to work and duplicate entries will be made with subsequent runs. - - Has no effect on Solaris systems or when used with C(ephemeral). + - Has no effect on Solaris systems or when used with O(state=ephemeral). type: str default: '0' passno: description: - Passno (see fstab(5)). - - Note that if set to C(null) and I(state) set to C(present), + - Note that if set to C(null) and O(state=present), it will cease to work and duplicate entries will be made with subsequent runs. - - Deprecated on Solaris systems. Has no effect when used with C(ephemeral). + - Deprecated on Solaris systems. Has no effect when used with O(state=ephemeral). type: str default: '0' state: description: - - If C(mounted), the device will be actively mounted and appropriately + - If V(mounted), the device will be actively mounted and appropriately configured in I(fstab). If the mount point is not present, the mount point will be created. - - If C(unmounted), the device will be unmounted without changing I(fstab). - - C(present) only specifies that the device is to be configured in + - If V(unmounted), the device will be unmounted without changing I(fstab). + - V(present) only specifies that the device is to be configured in I(fstab) and does not trigger or require a mount. - - C(ephemeral) only specifies that the device is to be mounted, without changing + - V(ephemeral) only specifies that the device is to be mounted, without changing I(fstab). If it is already mounted, a remount will be triggered. - This will always return changed=True. If the mount point I(path) - has already a device mounted on, and its source is different than I(src), + This will always return RV(ignore:changed=True). If the mount point O(path) + has already a device mounted on, and its source is different than O(src), the module will fail to avoid unexpected unmount or mount point override. If the mount point is not present, the mount point will be created. The I(fstab) is completely ignored. This option is added in version 1.5.0. - - C(absent) specifies that the mount point entry I(path) will be removed + - V(absent) specifies that the mount point entry O(path) will be removed from I(fstab) and will also unmount the mounted device and remove the - mount point. A mounted device will be unmounted regardless of I(src) or its - real source. C(absent) does not unmount recursively, and the module will + mount point. A mounted device will be unmounted regardless of O(src) or its + real source. V(absent) does not unmount recursively, and the module will fail if multiple devices are mounted on the same mount point. Using - C(absent) with a mount point that is not registered in the I(fstab) has - no effect. Use C(unmounted) instead.. - - C(remounted) specifies that the device will be remounted for when you + V(absent) with a mount point that is not registered in the I(fstab) has + no effect, use V(unmounted) instead. + - V(remounted) specifies that the device will be remounted for when you want to force a refresh on the mount itself (added in 2.9). This will - always return changed=true. If I(opts) is set, the options will be + always return RV(ignore:changed=true). If O(opts) is set, the options will be applied to the remount, but will not change I(fstab). Additionally, - if I(opts) is set, and the remount command fails, the module will - error to prevent unexpected mount changes. Try using C(mounted) - instead to work around this issue. C(remounted) expects the mount point + if O(opts) is set, and the remount command fails, the module will + error to prevent unexpected mount changes. Try using V(mounted) + instead to work around this issue. V(remounted) expects the mount point to be present in the I(fstab). To remount a mount point not registered - in I(fstab), use C(ephemeral) instead, especially with BSD nodes. - - C(absent_from_fstab) specifies that the device mount's entry will be + in I(fstab), use V(ephemeral) instead, especially with BSD nodes. + - V(absent_from_fstab) specifies that the device mount's entry will be removed from I(fstab). This option does not unmount it or delete the mountpoint. type: str @@ -105,20 +105,20 @@ options: - This might be useful if you need to configure mountpoints in a chroot environment. - OpenBSD does not allow specifying alternate fstab files with mount so do not use this on OpenBSD with any state that operates on the live filesystem. - - This parameter defaults to /etc/fstab or /etc/vfstab on Solaris. - - This parameter is ignored when I(state) is set to C(ephemeral). + - This parameter defaults to C(/etc/fstab) or C(/etc/vfstab) on Solaris. + - This parameter is ignored when O(state=ephemeral). type: str boot: description: - Determines if the filesystem should be mounted on boot. - Only applies to Solaris and Linux systems. - For Solaris systems, C(true) will set C(yes) as the value of mount at boot - in I(/etc/vfstab). + in C(/etc/vfstab). - For Linux, FreeBSD, NetBSD and OpenBSD systems, C(false) will add C(noauto) - to mount options in I(/etc/fstab). - - To avoid mount option conflicts, if C(noauto) specified in C(opts), - mount module will ignore C(boot). - - This parameter is ignored when I(state) is set to C(ephemeral). + to mount options in C(/etc/fstab). + - To avoid mount option conflicts, if C(noauto) specified in O(opts), + mount module will ignore O(boot). + - This parameter is ignored when O(state=ephemeral). type: bool default: true backup: @@ -128,9 +128,9 @@ options: type: bool default: false notes: - - As of Ansible 2.3, the I(name) option has been changed to I(path) as - default, but I(name) still works as well. - - Using C(remounted) with I(opts) set may create unexpected results based on + - As of Ansible 2.3, the O(name) option has been changed to O(path) as + default, but O(name) still works as well. + - Using O(state=remounted) with O(opts) set may create unexpected results based on the existing options already defined on mount, so care should be taken to ensure that conflicting options are not present before hand. ''' diff --git a/plugins/modules/patch.py b/plugins/modules/patch.py index ecedbf6..39744a7 100644 --- a/plugins/modules/patch.py +++ b/plugins/modules/patch.py @@ -24,7 +24,7 @@ options: basedir: description: - Path of a base directory in which the patch file will be applied. - - May be omitted when C(dest) option is specified, otherwise required. + - May be omitted when O(dest) option is specified, otherwise required. type: path dest: description: @@ -37,7 +37,7 @@ options: src: description: - Path of the patch file as accepted by the GNU patch tool. If - C(remote_src) is C(false), the patch source file is looked up from the + O(remote_src=false), the patch source file is looked up from the module's I(files) directory. type: path required: true @@ -50,8 +50,8 @@ options: default: present remote_src: description: - - If C(false), it will search for src at originating/controller machine, if C(true) it will - go to the remote/target machine for the C(src). + - If V(false), it will search for src at originating/controller machine, + - If C(true), it will go to the remote/target machine for the O(src). type: bool default: false strip: @@ -68,15 +68,15 @@ options: default: false binary: description: - - Setting to C(true) will disable patch's heuristic for transforming CRLF + - Setting to V(true) will disable patch's heuristic for transforming CRLF line endings into LF. - - Line endings of src and dest must match. - - If set to C(false), C(patch) will replace CRLF in C(src) files on POSIX. + - Line endings of O(src) and O(dest) must match. + - If set to V(false), C(patch) will replace CRLF in O(src) files on POSIX. type: bool default: false ignore_whitespace: description: - - Setting to C(true) will ignore white space changes between patch and input. + - Setting to V(true) will ignore white space changes between patch and input. type: bool default: false notes: diff --git a/plugins/modules/rhel_facts.py b/plugins/modules/rhel_facts.py index a30622a..d0c5927 100644 --- a/plugins/modules/rhel_facts.py +++ b/plugins/modules/rhel_facts.py @@ -13,7 +13,7 @@ module: rhel_facts version_added: 1.5.0 short_description: Facts module to set or override RHEL specific facts. description: - - Compatibility layer for using the "package" module for rpm-ostree based systems via setting the "pkg_mgr" fact correctly. + - Compatibility layer for using the M(ansible.builtin.package) module for rpm-ostree based systems via setting the C(pkg_mgr) fact correctly. author: - Adam Miller (@maxamillion) requirements: diff --git a/plugins/modules/rhel_rpm_ostree.py b/plugins/modules/rhel_rpm_ostree.py index 0976e02..0aafb54 100644 --- a/plugins/modules/rhel_rpm_ostree.py +++ b/plugins/modules/rhel_rpm_ostree.py @@ -25,12 +25,12 @@ requirements: options: name: description: - - A package name or package specifier with version, like C(name-1.0). - - Comparison operators for package version are valid here C(>), C(<), C(>=), C(<=). Example - C(name>=1.0) + - A package name or package specifier with version, like V(name-1.0). + - Comparison operators for package version are valid here C(>), C(<), C(>=), C(<=). Example - C(name>=1.0). - If a previous version is specified, the task also needs to turn C(allow_downgrade) on. See the C(allow_downgrade) documentation for caveats with downgrading packages. - - When using state=latest, this can be C('*') which means run C(yum -y update). - - You can also pass a url or a local path to a rpm file (using state=present). + - When using O(state=latest), this can be V('*') which means run C(yum -y update). + - You can also pass a url or a local path to a rpm file (using O(state=present)). To operate on several packages this can accept a comma separated string of packages or (as of 2.0) a list of packages. aliases: [ pkg ] type: list @@ -38,12 +38,12 @@ options: default: [] state: description: - - Whether to install (C(present) or C(installed), C(latest)), or remove (C(absent) or C(removed)) a package. - - C(present) and C(installed) will simply ensure that a desired package is installed. - - C(latest) will update the specified package if it's not of the latest available version. - - C(absent) and C(removed) will remove the specified package. - - Default is C(None), however in effect the default action is C(present) unless the C(autoremove) option is - enabled for this module, then C(absent) is inferred. + - Whether to install (V(present) or V(installed), V(latest)), or remove (V(absent) or V(removed)) a package. + - V(present) and V(installed) will simply ensure that a desired package is installed. + - V(latest) will update the specified package if it's not of the latest available version. + - V(absent) and V(removed) will remove the specified package. + - Default is C(null), however in effect the default action is V(present) unless the C(autoremove) option is + enabled for this module, then V(absent) is inferred. type: str choices: [ absent, installed, latest, present, removed ] notes: diff --git a/plugins/modules/seboolean.py b/plugins/modules/seboolean.py index 1e73aef..8580c62 100644 --- a/plugins/modules/seboolean.py +++ b/plugins/modules/seboolean.py @@ -22,12 +22,12 @@ options: type: str persistent: description: - - Set to C(true) if the boolean setting should survive a reboot. + - Set to V(true) if the boolean setting should survive a reboot. type: bool default: false state: description: - - Desired boolean value + - Desired boolean value. type: bool required: true ignore_selinux_state: diff --git a/plugins/modules/selinux.py b/plugins/modules/selinux.py index 0609462..41c51d0 100644 --- a/plugins/modules/selinux.py +++ b/plugins/modules/selinux.py @@ -20,7 +20,7 @@ version_added: "1.0.0" options: policy: description: - - The name of the SELinux policy to use (e.g. C(targeted)) will be required if I(state) is not C(disabled). + - The name of the SELinux policy to use (e.g. C(targeted)) will be required unless O(state=disabled). type: str state: description: @@ -30,7 +30,7 @@ options: type: str update_kernel_param: description: - - If set to I(true), will update also the kernel boot parameters when disabling/enabling SELinux. + - If set to V(true), will update also the kernel boot parameters when disabling/enabling SELinux. - The C(grubby) tool must be present on the target system for this to work. default: false type: bool diff --git a/plugins/modules/synchronize.py b/plugins/modules/synchronize.py index 3d8d0fe..3c3ba25 100644 --- a/plugins/modules/synchronize.py +++ b/plugins/modules/synchronize.py @@ -14,12 +14,13 @@ DOCUMENTATION = r''' module: synchronize short_description: A wrapper around rsync to make common tasks in your playbooks quick and easy description: - - C(synchronize) is a wrapper around rsync to make common tasks in your playbooks quick and easy. + - M(ansible.posix.synchronize) is a wrapper around C(rsync) to make common tasks in your playbooks quick and easy. - It is run and originates on the local host where Ansible is being run. - - Of course, you could just use the C(command) action to call rsync yourself, but you also have to add a fair number of + - Of course, you could just use the M(ansible.builtin.command) action to call C(rsync) yourself, but you also have to add a fair number of boilerplate options and host facts. - - This module is not intended to provide access to the full power of rsync, but does make the most common - invocations easier to implement. You `still` may need to call rsync directly via C(command) or C(shell) depending on your use case. + - This module is not intended to provide access to the full power of C(rsync), but does make the most common + invocations easier to implement. + You I(still) may need to call C(rsync) directly via M(ansible.builtin.command) or M(ansible.builtin.shell) depending on your use case. version_added: "1.0.0" options: src: @@ -37,27 +38,27 @@ options: dest_port: description: - Port number for ssh on the destination host. - - Prior to Ansible 2.0, the ansible_ssh_port inventory var took precedence over this value. + - Prior to Ansible 2.0, the C(ansible_ssh_port) inventory var took precedence over this value. - This parameter defaults to the value of C(ansible_port), the C(remote_port) config setting or the value from ssh client configuration if none of the former have been set. type: int mode: description: - Specify the direction of the synchronization. - - In push mode the localhost or delegate is the source. - - In pull mode the remote host in context is the source. + - In V(push) mode the localhost or delegate is the source. + - In V(pull) mode the remote host in context is the source. type: str choices: [ pull, push ] default: push archive: description: - - Mirrors the rsync archive flag, enables recursive, links, perms, times, owner, group flags and -D. + - Mirrors the rsync archive flag, enables recursive, links, perms, times, owner, group flags and C(-D). type: bool default: true checksum: description: - - Skip based on checksum, rather than mod-time & size; Note that that "archive" option is still enabled by default - the "checksum" option will - not disable it. + - Skip based on checksum, rather than mod-time & size; Note that that O(archive) option is still enabled by default - + the O(checksum) option will not disable it. type: bool default: false compress: @@ -73,8 +74,8 @@ options: default: false delete: description: - - Delete files in I(dest) that do not exist (after transfer, not before) in the I(src) path. - - This option requires I(recursive=true). + - Delete files in O(dest) that do not exist (after transfer, not before) in the O(src) path. + - This option requires O(recursive=true). - This option ignores excluded files and behaves like the rsync opt C(--delete-after). type: bool default: false @@ -130,17 +131,17 @@ options: default: 0 set_remote_user: description: - - Put user@ for the remote paths. + - Put C(user@) for the remote paths. - If you have a custom ssh config to define the remote user for a host - that does not match the inventory user, you should set this parameter to C(false). + that does not match the inventory user, you should set this parameter to V(false). type: bool default: true ssh_connection_multiplexing: description: - SSH connection multiplexing for rsync is disabled by default to prevent misconfigured ControlSockets from resulting in failed SSH connections. This is accomplished by setting the SSH C(ControlSocket) to C(none). - - Set this option to C(true) to allow multiplexing and reduce SSH connection overhead. - - Note that simply setting this option to C(true) is not enough; + - Set this option to V(true) to allow multiplexing and reduce SSH connection overhead. + - Note that simply setting this option to V(true) is not enough; You must also configure SSH connection multiplexing in your SSH client config by setting values for C(ControlMaster), C(ControlPersist) and C(ControlPath). type: bool @@ -182,7 +183,7 @@ options: use_ssh_args: description: - In Ansible 2.10 and lower, it uses the ssh_args specified in C(ansible.cfg). - - In Ansible 2.11 and onwards, when set to C(true), it uses all SSH connection configurations like + - In Ansible 2.11 and onwards, when set to V(true), it uses all SSH connection configurations like C(ansible_ssh_args), C(ansible_ssh_common_args), and C(ansible_ssh_extra_args). type: bool default: false @@ -200,31 +201,31 @@ options: type: bool default: false _ssh_args: - description: Internal use only. See C(use_ssh_args) for ssh arg settings. + description: Internal use only. See O(use_ssh_args) for ssh arg settings. type: str required: false notes: - - rsync must be installed on both the local and remote host. - - For the C(synchronize) module, the "local host" is the host `the synchronize task originates on`, and the "destination host" is the host - `synchronize is connecting to`. - - The "local host" can be changed to a different host by using `delegate_to`. This enables copying between two remote hosts or entirely on one - remote machine. + - C(rsync) must be installed on both the local and remote host. + - For the M(ansible.posix.synchronize) module, the "local host" is the host `the synchronize task originates on`, + and the "destination host" is the host `synchronize is connecting to`. + - The "local host" can be changed to a different host by using C(delegate_to). + This enables copying between two remote hosts or entirely on one remote machine. - > - The user and permissions for the synchronize `src` are those of the user running the Ansible task on the local host (or the remote_user for a - delegate_to host when delegate_to is used). + The user and permissions for the synchronize O(src) are those of the user running the Ansible task on the local host (or the remote_user for a + C(delegate_to) host when C(delegate_to) is used). - The user and permissions for the synchronize `dest` are those of the `remote_user` on the destination host or the `become_user` if `become=yes` is active. - In Ansible 2.0 a bug in the synchronize module made become occur on the "local host". This was fixed in Ansible 2.0.1. - - Currently, synchronize is limited to elevating permissions via passwordless sudo. This is because rsync itself is connecting to the remote machine - and rsync doesn't give us a way to pass sudo credentials in. + - Currently, M(ansible.posix.synchronize) is limited to elevating permissions via passwordless sudo. + This is because rsync itself is connecting to the remote machine and rsync doesn't give us a way to pass sudo credentials in. - Currently there are only a few connection types which support synchronize (ssh, paramiko, local, and docker) because a sync strategy has been determined for those connection types. Note that the connection for these must not need a password as rsync itself is making the connection and rsync does not provide us a way to pass a password to the connection. - - Expect that dest=~/x will be ~/x even if using sudo. + - Expect that O(dest=~/x) will be V(~/x) even if using sudo. - Inspect the verbose output to validate the destination user/host/path are what was expected. - To exclude files and directories from being synchronized, you may add C(.rsync-filter) files to the source directory. - rsync daemon must be up and running with correct permission when using rsync protocol in source or destination path. - - The C(synchronize) module enables `--delay-updates` by default to avoid leaving a destination in a broken in-between state if the underlying rsync process + - The C(synchronize) module enables C(--delay-updates) by default to avoid leaving a destination in a broken in-between state if the underlying rsync process encounters an error. Those synchronizing large numbers of files that are willing to trade safety for performance should disable this option. - link_destination is subject to the same limitations as the underlying rsync daemon. Hard links are only preserved if the relative subtrees of the source and destination are the same. Attempts to hardlink into a directory that is a subdirectory of the source will be prevented. diff --git a/plugins/modules/sysctl.py b/plugins/modules/sysctl.py index 7914e9d..3d1242f 100644 --- a/plugins/modules/sysctl.py +++ b/plugins/modules/sysctl.py @@ -19,7 +19,7 @@ version_added: "1.0.0" options: name: description: - - The dot-separated path (also known as I(key)) specifying the sysctl variable. + - The dot-separated path (also known as O(key)) specifying the sysctl variable. required: true aliases: [ 'key' ] type: str @@ -41,8 +41,8 @@ options: default: false reload: description: - - If C(true), performs a I(/sbin/sysctl -p) if the C(sysctl_file) is - updated. If C(false), does not reload I(sysctl) even if the + - If V(true), performs a C(/sbin/sysctl -p) if the O(sysctl_file) is + updated. If V(false), does not reload C(sysctl) even if the C(sysctl_file) is updated. type: bool default: true @@ -53,7 +53,7 @@ options: type: path sysctl_set: description: - - Verify token value with the sysctl command and set with -w if necessary. + - Verify token value with the sysctl command and set with C(-w) if necessary. type: bool default: false author: From ef07eb8a06197ce1fa504b89077ff815ecfe290f Mon Sep 17 00:00:00 2001 From: Alexei Znamensky <103110+russoz@users.noreply.github.com> Date: Sun, 9 Jun 2024 11:49:33 +1200 Subject: [PATCH 2/2] Apply suggestions from code review Thanks felixfontein for the thorough review. :-) Co-authored-by: Felix Fontein --- plugins/modules/at.py | 2 +- plugins/modules/firewalld.py | 2 +- plugins/modules/mount.py | 8 ++++---- plugins/modules/synchronize.py | 6 +++--- plugins/modules/sysctl.py | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/plugins/modules/at.py b/plugins/modules/at.py index fefe6f2..9367ac2 100644 --- a/plugins/modules/at.py +++ b/plugins/modules/at.py @@ -36,7 +36,7 @@ options: choices: [ minutes, hours, days, weeks ] state: description: - - The state dictates if the command or script file should be evaluated as V(present)(added) or V(absent)(deleted). + - The state dictates if the command or script file should be evaluated as V(present) (added) or V(absent) (deleted). type: str choices: [ absent, present ] default: present diff --git a/plugins/modules/firewalld.py b/plugins/modules/firewalld.py index dc930ca..12dd27b 100644 --- a/plugins/modules/firewalld.py +++ b/plugins/modules/firewalld.py @@ -86,7 +86,7 @@ options: description: - Whether to apply this change to the permanent firewalld configuration. - As of Ansible 2.3, permanent operations can operate on firewalld configs when it is not running (requires firewalld >= 0.3.9). - - Note that if this is V(false), O(immediate=true). + - Note that if this is V(false), O(immediate=true) by default. type: bool default: false immediate: diff --git a/plugins/modules/mount.py b/plugins/modules/mount.py index 4fdd826..144f46e 100644 --- a/plugins/modules/mount.py +++ b/plugins/modules/mount.py @@ -24,20 +24,20 @@ options: path: description: - Path to the mount point (e.g. C(/mnt/files)). - - Before Ansible 2.3 this option was only usable as O(ignore:dest), O(ignore:destfile) and O(name). + - Before Ansible 2.3 this option was only usable as O(ignore:dest), O(ignore:destfile), and O(name). type: path required: true aliases: [ name ] src: description: - Device (or NFS volume, or something else) to be mounted on I(path). - - Required when O(state) set to V(present), V(mounted) or V(ephemeral). + - Required when O(state) set to V(present), V(mounted), or V(ephemeral). - Ignored when O(state) set to V(absent) or V(unmounted). type: path fstype: description: - Filesystem type. - - Required when O(state) is V(present), V(mounted) or V(ephemeral). + - Required when O(state) is V(present), V(mounted), or V(ephemeral). type: str opts: description: @@ -71,7 +71,7 @@ options: I(fstab) and does not trigger or require a mount. - V(ephemeral) only specifies that the device is to be mounted, without changing I(fstab). If it is already mounted, a remount will be triggered. - This will always return RV(ignore:changed=True). If the mount point O(path) + This will always return RV(ignore:changed=true). If the mount point O(path) has already a device mounted on, and its source is different than O(src), the module will fail to avoid unexpected unmount or mount point override. If the mount point is not present, the mount point will be created. diff --git a/plugins/modules/synchronize.py b/plugins/modules/synchronize.py index 3c3ba25..d65e08f 100644 --- a/plugins/modules/synchronize.py +++ b/plugins/modules/synchronize.py @@ -52,7 +52,7 @@ options: default: push archive: description: - - Mirrors the rsync archive flag, enables recursive, links, perms, times, owner, group flags and C(-D). + - Mirrors the rsync archive flag, enables recursive, links, perms, times, owner, group flags, and C(-D). type: bool default: true checksum: @@ -207,8 +207,8 @@ options: notes: - C(rsync) must be installed on both the local and remote host. - - For the M(ansible.posix.synchronize) module, the "local host" is the host `the synchronize task originates on`, - and the "destination host" is the host `synchronize is connecting to`. + - For the M(ansible.posix.synchronize) module, the "local host" is the host I(the synchronize task originates on), + and the "destination host" is the host I(synchronize is connecting to). - The "local host" can be changed to a different host by using C(delegate_to). This enables copying between two remote hosts or entirely on one remote machine. - > diff --git a/plugins/modules/sysctl.py b/plugins/modules/sysctl.py index 3d1242f..3edcc72 100644 --- a/plugins/modules/sysctl.py +++ b/plugins/modules/sysctl.py @@ -43,7 +43,7 @@ options: description: - If V(true), performs a C(/sbin/sysctl -p) if the O(sysctl_file) is updated. If V(false), does not reload C(sysctl) even if the - C(sysctl_file) is updated. + O(sysctl_file) is updated. type: bool default: true sysctl_file: