Skip to content

Commit

Permalink
l*.py: normalize docs (#9390)
Browse files Browse the repository at this point in the history
  • Loading branch information
russoz authored Dec 26, 2024
1 parent 6b7ea34 commit cea6eee
Show file tree
Hide file tree
Showing 25 changed files with 1,195 additions and 1,351 deletions.
90 changes: 42 additions & 48 deletions plugins/modules/launchd.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
from __future__ import absolute_import, division, print_function
__metaclass__ = type

DOCUMENTATION = r'''
---
DOCUMENTATION = r"""
module: launchd
author:
- Martin Migasiewicz (@martinm82)
Expand All @@ -20,57 +19,52 @@
extends_documentation_fragment:
- community.general.attributes
attributes:
check_mode:
support: full
diff_mode:
support: none
check_mode:
support: full
diff_mode:
support: none
options:
name:
description:
name:
description:
- Name of the service.
type: str
required: true
plist:
description:
type: str
required: true
plist:
description:
- Name of the V(.plist) file for the service.
- Defaults to V({name}.plist).
type: str
version_added: 10.1.0
state:
description:
- V(started)/V(stopped) are idempotent actions that will not run
commands unless necessary.
- Launchd does not support V(restarted) nor V(reloaded) natively.
These will trigger a stop/start (restarted) or an unload/load
(reloaded).
- V(restarted) unloads and loads the service before start to ensure
that the latest job definition (plist) is used.
- V(reloaded) unloads and loads the service to ensure that the latest
job definition (plist) is used. Whether a service is started or
stopped depends on the content of the definition file.
type: str
choices: [ reloaded, restarted, started, stopped, unloaded ]
enabled:
description:
type: str
version_added: 10.1.0
state:
description:
- V(started)/V(stopped) are idempotent actions that will not run commands unless necessary.
- Launchd does not support V(restarted) nor V(reloaded) natively. These will trigger a stop/start (restarted) or an unload/load (reloaded).
- V(restarted) unloads and loads the service before start to ensure that the latest job definition (plist) is used.
- V(reloaded) unloads and loads the service to ensure that the latest job definition (plist) is used. Whether a service is started or stopped
depends on the content of the definition file.
type: str
choices: [reloaded, restarted, started, stopped, unloaded]
enabled:
description:
- Whether the service should start on boot.
- B(At least one of state and enabled are required.)
type: bool
force_stop:
description:
- B(At least one of state and enabled are required).
type: bool
force_stop:
description:
- Whether the service should not be restarted automatically by launchd.
- Services might have the 'KeepAlive' attribute set to true in a launchd configuration.
In case this is set to true, stopping a service will cause that launchd starts the service again.
- Set this option to V(true) to let this module change the 'KeepAlive' attribute to V(false).
type: bool
default: false
- Services might have the 'KeepAlive' attribute set to true in a launchd configuration. In case this is set to true, stopping a service
will cause that launchd starts the service again.
- Set this option to V(true) to let this module change the C(KeepAlive) attribute to V(false).
type: bool
default: false
notes:
- A user must privileged to manage services using this module.
- A user must privileged to manage services using this module.
requirements:
- A system managed by launchd
- The plistlib python library
'''
- A system managed by launchd
- The plistlib Python library
"""

EXAMPLES = r'''
EXAMPLES = r"""
- name: Make sure spotify webhelper is started
community.general.launchd:
name: com.spotify.webhelper
Expand Down Expand Up @@ -112,11 +106,11 @@
name: com.openssh.sshd
plist: ssh.plist
state: restarted
'''
"""

RETURN = r'''
RETURN = r"""
status:
description: Metadata about service status
description: Metadata about service status.
returned: always
type: dict
sample:
Expand All @@ -126,7 +120,7 @@
"previous_pid": "82636",
"previous_state": "running"
}
'''
"""

import os
import plistlib
Expand Down
26 changes: 11 additions & 15 deletions plugins/modules/layman.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@
__metaclass__ = type


DOCUMENTATION = '''
---
DOCUMENTATION = r"""
module: layman
author: "Jakub Jirutka (@jirutka)"
short_description: Manage Gentoo overlays
description:
- Uses Layman to manage an additional repositories for the Portage package manager on Gentoo Linux.
Please note that Layman must be installed on a managed node prior using this module.
- Uses Layman to manage an additional repositories for the Portage package manager on Gentoo Linux. Please note that Layman must be installed
on a managed node prior using this module.
requirements:
- layman python module
extends_documentation_fragment:
Expand All @@ -30,15 +29,13 @@
options:
name:
description:
- The overlay id to install, synchronize, or uninstall.
Use 'ALL' to sync all of the installed overlays (can be used only when O(state=updated)).
- The overlay id to install, synchronize, or uninstall. Use V(ALL) to sync all of the installed overlays (can be used only when O(state=updated)).
required: true
type: str
list_url:
description:
- An URL of the alternative overlays list that defines the overlay to install.
This list will be fetched and saved under C(${overlay_defs}/${name}.xml), where
C(overlay_defs) is read from the Layman's configuration.
- An URL of the alternative overlays list that defines the overlay to install. This list will be fetched and saved under C(${overlay_defs}/${name}.xml),
where C(overlay_defs) is read from the Layman's configuration.
aliases: [url]
type: str
state:
Expand All @@ -49,14 +46,13 @@
type: str
validate_certs:
description:
- If V(false), SSL certificates will not be validated. This should only be
set to V(false) when no other option exists. Prior to 1.9.3 the code
defaulted to V(false).
- If V(false), SSL certificates will not be validated. This should only be set to V(false) when no other option exists. Prior to 1.9.3 the
code defaulted to V(false).
type: bool
default: true
'''
"""

EXAMPLES = '''
EXAMPLES = r"""
- name: Install the overlay mozilla which is on the central overlays list
community.general.layman:
name: mozilla
Expand All @@ -81,7 +77,7 @@
community.general.layman:
name: cvut
state: absent
'''
"""

import shutil
import traceback
Expand Down
30 changes: 14 additions & 16 deletions plugins/modules/lbu.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,15 @@
from __future__ import absolute_import, division, print_function
__metaclass__ = type

DOCUMENTATION = '''
---
DOCUMENTATION = r"""
module: lbu
short_description: Local Backup Utility for Alpine Linux
version_added: '0.2.0'
description:
- Manage Local Backup Utility of Alpine Linux in run-from-RAM mode
- Manage Local Backup Utility of Alpine Linux in run-from-RAM mode.
extends_documentation_fragment:
- community.general.attributes
Expand All @@ -31,24 +29,24 @@
options:
commit:
description:
- Control whether to commit changed files.
- Control whether to commit changed files.
type: bool
exclude:
description:
- List of paths to exclude.
- List of paths to exclude.
type: list
elements: str
include:
description:
- List of paths to include.
- List of paths to include.
type: list
elements: str
author:
- Kaarle Ritvanen (@kunkku)
'''
"""

EXAMPLES = '''
EXAMPLES = r"""
# Commit changed files (if any)
- name: Commit
community.general.lbu:
Expand All @@ -59,22 +57,22 @@
community.general.lbu:
commit: true
exclude:
- /etc/opt
- /etc/opt
# Include paths without committing
- name: Include file and directory
community.general.lbu:
include:
- /root/.ssh/authorized_keys
- /var/lib/misc
'''
- /root/.ssh/authorized_keys
- /var/lib/misc
"""

RETURN = '''
RETURN = r"""
msg:
description: Error message
description: Error message.
type: str
returned: on failure
'''
"""

from ansible.module_utils.basic import AnsibleModule

Expand Down
Loading

0 comments on commit cea6eee

Please sign in to comment.