zypper: adjust docs (#9307)

* adjust docs

* Update plugins/modules/zypper.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/zypper.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/zypper_repository.py

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
pull/8437/merge
Alexei Znamensky 2024-12-23 21:28:19 +13:00 committed by GitHub
parent b57fef201e
commit e809a25486
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 242 additions and 252 deletions

View File

@ -18,143 +18,141 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
---
module: zypper module: zypper
author: author:
- "Patrick Callahan (@dirtyharrycallahan)" - "Patrick Callahan (@dirtyharrycallahan)"
- "Alexander Gubin (@alxgu)" - "Alexander Gubin (@alxgu)"
- "Thomas O'Donnell (@andytom)" - "Thomas O'Donnell (@andytom)"
- "Robin Roth (@robinro)" - "Robin Roth (@robinro)"
- "Andrii Radyk (@AnderEnder)" - "Andrii Radyk (@AnderEnder)"
short_description: Manage packages on SUSE and openSUSE short_description: Manage packages on SUSE and openSUSE
description: description:
- Manage packages on SUSE and openSUSE using the zypper and rpm tools. - Manage packages on SUSE and openSUSE using the zypper and rpm tools.
- Also supports transactional updates, by running zypper inside C(/sbin/transactional-update --continue --drop-if-no-change --quiet run). - Also supports transactional updates, by running zypper inside C(/sbin/transactional-update --continue --drop-if-no-change --quiet run).
extends_documentation_fragment: extends_documentation_fragment:
- community.general.attributes - community.general.attributes
- community.general.attributes - community.general.attributes
attributes: attributes:
check_mode: check_mode:
support: full support: full
diff_mode: diff_mode:
support: full support: full
options: options:
name: name:
description: description:
- Package name V(name) or package specifier or a list of either. - Package name V(name) or package specifier or a list of either.
- Can include a version like V(name=1.0), V(name>3.4) or V(name<=2.7). If a version is given, V(oldpackage) is implied and zypper is allowed to - Can include a version like V(name=1.0), V(name>3.4) or V(name<=2.7). If a version is given, V(oldpackage) is implied and zypper is allowed
update the package within the version range given. to update the package within the version range given.
- You can also pass a url or a local path to a rpm file. - You can also pass a url or a local path to a rpm file.
- When using O(state=latest), this can be '*', which updates all installed packages. - When using O(state=latest), this can be V(*), which updates all installed packages.
required: true required: true
aliases: [ 'pkg' ] aliases: ['pkg']
type: list type: list
elements: str elements: str
state: state:
description: description:
- V(present) will make sure the package is installed. - V(present) will make sure the package is installed.
V(latest) will make sure the latest version of the package is installed. - V(latest) will make sure the latest version of the package is installed.
V(absent) will make sure the specified package is not installed. - V(absent) will make sure the specified package is not installed.
V(dist-upgrade) will make sure the latest version of all installed packages from all enabled repositories is installed. - V(dist-upgrade) will make sure the latest version of all installed packages from all enabled repositories is installed.
- When using V(dist-upgrade), O(name) should be V('*'). - When using V(dist-upgrade), O(name) should be V(*).
required: false required: false
choices: [ present, latest, absent, dist-upgrade, installed, removed ] choices: [present, latest, absent, dist-upgrade, installed, removed]
default: "present" default: "present"
type: str type: str
type: type:
description: description:
- The type of package to be operated on. - The type of package to be operated on.
required: false required: false
choices: [ package, patch, pattern, product, srcpackage, application ] choices: [package, patch, pattern, product, srcpackage, application]
default: "package" default: "package"
type: str type: str
extra_args_precommand: extra_args_precommand:
required: false required: false
description: description:
- Add additional global target options to C(zypper). - Add additional global target options to C(zypper).
- Options should be supplied in a single line as if given in the command line. - Options should be supplied in a single line as if given in the command line.
type: str type: str
disable_gpg_check: disable_gpg_check:
description: description:
- Whether to disable to GPG signature checking of the package - Whether to disable to GPG signature checking of the package signature being installed. Has an effect only if O(state) is V(present) or
signature being installed. Has an effect only if O(state) is V(latest).
V(present) or V(latest). required: false
required: false default: false
default: false type: bool
type: bool disable_recommends:
disable_recommends: description:
description: - Corresponds to the C(--no-recommends) option for I(zypper). Default behavior (V(true)) modifies zypper's default behavior; V(false) does
- Corresponds to the C(--no-recommends) option for I(zypper). Default behavior (V(true)) modifies zypper's default behavior; V(false) does install recommended packages.
install recommended packages. required: false
required: false default: true
default: true type: bool
type: bool force:
force: description:
description: - Adds C(--force) option to I(zypper). Allows to downgrade packages and change vendor or architecture.
- Adds C(--force) option to I(zypper). Allows to downgrade packages and change vendor or architecture. required: false
required: false default: false
default: false type: bool
type: bool force_resolution:
force_resolution: description:
description: - Adds C(--force-resolution) option to I(zypper). Allows to (un)install packages with conflicting requirements (resolver will choose a solution).
- Adds C(--force-resolution) option to I(zypper). Allows to (un)install packages with conflicting requirements (resolver will choose a solution). required: false
required: false default: false
default: false type: bool
type: bool version_added: '0.2.0'
version_added: '0.2.0' update_cache:
update_cache: description:
description: - Run the equivalent of C(zypper refresh) before the operation. Disabled in check mode.
- Run the equivalent of C(zypper refresh) before the operation. Disabled in check mode. required: false
required: false default: false
default: false type: bool
type: bool aliases: ["refresh"]
aliases: [ "refresh" ] oldpackage:
oldpackage: description:
description: - Adds C(--oldpackage) option to I(zypper). Allows to downgrade packages with less side-effects than force. This is implied as soon as a
- Adds C(--oldpackage) option to I(zypper). Allows to downgrade packages with less side-effects than force. This is implied as soon as a version is specified as part of the package name.
version is specified as part of the package name. required: false
required: false default: false
default: false type: bool
type: bool extra_args:
extra_args: required: false
required: false description:
description: - Add additional options to C(zypper) command.
- Add additional options to C(zypper) command. - Options should be supplied in a single line as if given in the command line.
- Options should be supplied in a single line as if given in the command line. type: str
type: str allow_vendor_change:
allow_vendor_change: type: bool
type: bool required: false
required: false default: false
default: false description:
description: - Adds C(--allow_vendor_change) option to I(zypper) dist-upgrade command.
- Adds C(--allow_vendor_change) option to I(zypper) dist-upgrade command. version_added: '0.2.0'
version_added: '0.2.0' replacefiles:
replacefiles: type: bool
type: bool required: false
required: false default: false
default: false description:
description: - Adds C(--replacefiles) option to I(zypper) install/update command.
- Adds C(--replacefiles) option to I(zypper) install/update command. version_added: '0.2.0'
version_added: '0.2.0' clean_deps:
clean_deps: type: bool
type: bool required: false
required: false default: false
default: false description:
description: - Adds C(--clean-deps) option to I(zypper) remove command.
- Adds C(--clean-deps) option to I(zypper) remove command. version_added: '4.6.0'
version_added: '4.6.0'
notes: notes:
- When used with a C(loop:) each package will be processed individually, - When used with a C(loop:) each package will be processed individually, it is much more efficient to pass the list directly to the O(name)
it is much more efficient to pass the list directly to the O(name) option. option.
# informational: requirements for nodes # informational: requirements for nodes
requirements: requirements:
- "zypper >= 1.0 # included in openSUSE >= 11.1 or SUSE Linux Enterprise Server/Desktop >= 11.0" - "zypper >= 1.0 # included in openSUSE >= 11.1 or SUSE Linux Enterprise Server/Desktop >= 11.0"
- python-xml - python-xml
- rpm - rpm
''' """
EXAMPLES = ''' EXAMPLES = r"""
- name: Install nmap - name: Install nmap
community.general.zypper: community.general.zypper:
name: nmap name: nmap
@ -228,7 +226,7 @@ EXAMPLES = '''
state: present state: present
environment: environment:
ZYPP_LOCK_TIMEOUT: 20 ZYPP_LOCK_TIMEOUT: 20
''' """
import os.path import os.path
import xml import xml

View File

@ -11,91 +11,88 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
---
module: zypper_repository module: zypper_repository
author: "Matthias Vogelgesang (@matze)" author: "Matthias Vogelgesang (@matze)"
short_description: Add and remove Zypper repositories short_description: Add and remove Zypper repositories
description: description:
- Add or remove Zypper repositories on SUSE and openSUSE - Add or remove Zypper repositories on SUSE and openSUSE.
extends_documentation_fragment: extends_documentation_fragment:
- community.general.attributes - community.general.attributes
attributes: attributes:
check_mode: check_mode:
support: none support: none
diff_mode: diff_mode:
support: none support: none
options: options:
name: name:
description:
- A name for the repository. Not required when adding repofiles.
type: str
repo:
description:
- URI of the repository or .repo file. Required when state=present.
type: str
state:
description:
- A source string state.
choices: [ "absent", "present" ]
default: "present"
type: str
description: description:
description: - A name for the repository. Not required when adding repofiles.
- A description of the repository type: str
type: str repo:
disable_gpg_check: description:
description: - URI of the repository or full path of a C(.repo) file. Required when O(state=present).
- Whether to disable GPG signature checking of type: str
all packages. Has an effect only if O(state=present). state:
- Needs zypper version >= 1.6.2. description:
type: bool - Whether the repository should exist or not.
default: false - A source string state.
autorefresh: choices: ["absent", "present"]
description: default: "present"
- Enable autorefresh of the repository. type: str
type: bool description:
default: true description:
aliases: [ "refresh" ] - A description of the repository.
priority: type: str
description: disable_gpg_check:
- Set priority of repository. Packages will always be installed description:
from the repository with the smallest priority number. - Whether to disable GPG signature checking of all packages. Has an effect only if O(state=present).
- Needs zypper version >= 1.12.25. - Needs C(zypper) version >= 1.6.2.
type: int type: bool
overwrite_multiple: default: false
description: autorefresh:
- Overwrite multiple repository entries, if repositories with both name and description:
URL already exist. - Enable autorefresh of the repository.
type: bool type: bool
default: false default: true
auto_import_keys: aliases: ["refresh"]
description: priority:
- Automatically import the gpg signing key of the new or changed repository. description:
- Has an effect only if O(state=present). Has no effect on existing (unchanged) repositories or in combination with O(state=absent). - Set priority of repository. Packages will always be installed from the repository with the smallest priority number.
- Implies runrefresh. - Needs C(zypper) version >= 1.12.25.
- Only works with C(.repo) files if `name` is given explicitly. type: int
type: bool overwrite_multiple:
default: false description:
runrefresh: - Overwrite multiple repository entries, if repositories with both name and URL already exist.
description: type: bool
- Refresh the package list of the given repository. default: false
- Can be used with repo=* to refresh all repositories. auto_import_keys:
type: bool description:
default: false - Automatically import the gpg signing key of the new or changed repository.
enabled: - Has an effect only if O(state=present). Has no effect on existing (unchanged) repositories or in combination with O(state=absent).
description: - Implies O(runrefresh).
- Set repository to enabled (or disabled). - Only works with C(.repo) files if O(name) is given explicitly.
type: bool type: bool
default: true default: false
runrefresh:
description:
- Refresh the package list of the given repository.
- Can be used with O(repo=*) to refresh all repositories.
type: bool
default: false
enabled:
description:
- Set repository to enabled (or disabled).
type: bool
default: true
requirements: requirements:
- "zypper >= 1.0 # included in openSUSE >= 11.1 or SUSE Linux Enterprise Server/Desktop >= 11.0" - "zypper >= 1.0 # included in openSUSE >= 11.1 or SUSE Linux Enterprise Server/Desktop >= 11.0"
- python-xml - python-xml
''' """
EXAMPLES = ''' EXAMPLES = r"""
- name: Add NVIDIA repository for graphics drivers - name: Add NVIDIA repository for graphics drivers
community.general.zypper_repository: community.general.zypper_repository:
name: nvidia-repo name: nvidia-repo
@ -128,7 +125,7 @@ EXAMPLES = '''
name: my_ci_repo name: my_ci_repo
state: present state: present
runrefresh: true runrefresh: true
''' """
import traceback import traceback

View File

@ -10,72 +10,67 @@
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
---
module: zypper_repository_info module: zypper_repository_info
author: "Tobias Zeuch (@TobiasZeuch181)" author: "Tobias Zeuch (@TobiasZeuch181)"
version_added: 10.0.0 version_added: 10.0.0
short_description: List Zypper repositories short_description: List Zypper repositories
description: description:
- List Zypper repositories on SUSE and openSUSE. - List Zypper repositories on SUSE and openSUSE.
extends_documentation_fragment: extends_documentation_fragment:
- community.general.attributes - community.general.attributes
- community.general.attributes.info_module - community.general.attributes.info_module
requirements: requirements:
- "zypper >= 1.0 (included in openSUSE >= 11.1 or SUSE Linux Enterprise Server/Desktop >= 11.0)" - "zypper >= 1.0 (included in openSUSE >= 11.1 or SUSE Linux Enterprise Server/Desktop >= 11.0)"
- python-xml - python-xml
notes: notes:
- "For info about packages, use the module M(ansible.builtin.package_facts)." - "For info about packages, use the module M(ansible.builtin.package_facts)."
''' """
EXAMPLES = ''' EXAMPLES = r"""
- name: List registered repositories and store in variable repositories - name: List registered repositories and store in variable repositories
community.general.zypper_repository_info: {} community.general.zypper_repository_info: {}
register: repodatalist register: repodatalist
''' """
RETURN = ''' RETURN = r"""
repodatalist: repodatalist:
description: description:
- A list of repository descriptions like it is returned by the command C(zypper repos). - A list of repository descriptions like it is returned by the command C(zypper repos).
type: list type: list
returned: always returned: always
elements: dict elements: dict
contains: contains:
alias: alias:
description: The alias of the repository. description: The alias of the repository.
type: str type: str
autorefresh: sample: "SLE-Product-SLES"
description: Indicates, if autorefresh is enabled on the repository. autorefresh:
type: int description: Indicates, if autorefresh is enabled on the repository.
enabled: type: int
description: indicates, if the repository is enabled sample: "1"
type: int enabled:
gpgcheck: description: Indicates, if the repository is enabled.
description: indicates, if the GPG signature of the repository meta data is checked type: int
type: int sample: "1"
name: gpgcheck:
description: the name of the repository description: Indicates, if the GPG signature of the repository meta data is checked.
type: str type: int
priority: sample: "1"
description: the priority of the repository name:
type: int description: The name of the repository.
url: type: str
description: The URL of the repository on the internet. sample: "SLE-Product-SLES"
type: str priority:
sample: [ description: The priority of the repository.
{ type: int
"alias": "SLE-Product-SLES", sample: "99"
"autorefresh": "1", url:
"enabled": "1", description: The URL of the repository on the internet.
"gpgcheck": "1", type: str
"name": "SLE-Product-SLES", sample: "http://repo:50000/repo/SUSE/Products/SLE-Product-SLES/15-SP2/x86_64/product"
"priority": "99", """
"url": "http://repo:50000/repo/SUSE/Products/SLE-Product-SLES/15-SP2/x86_64/product"
}
]
'''
from ansible_collections.community.general.plugins.module_utils import deps from ansible_collections.community.general.plugins.module_utils import deps