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,8 +18,7 @@ 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)"
@ -43,30 +42,30 @@ 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:
@ -77,9 +76,8 @@ options:
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
@ -109,7 +107,7 @@ options:
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
@ -145,16 +143,16 @@ options:
- 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,13 +11,12 @@ 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:
@ -32,23 +31,23 @@ options:
type: str type: str
repo: repo:
description: description:
- URI of the repository or .repo file. Required when state=present. - URI of the repository or full path of a C(.repo) file. Required when O(state=present).
type: str type: str
state: state:
description: description:
- Whether the repository should exist or not.
- A source string state. - A source string state.
choices: [ "absent", "present" ] choices: ["absent", "present"]
default: "present" default: "present"
type: str type: str
description: description:
description: description:
- A description of the repository - A description of the repository.
type: str type: str
disable_gpg_check: disable_gpg_check:
description: description:
- Whether to disable GPG signature checking of - Whether to disable GPG signature checking of all packages. Has an effect only if O(state=present).
all packages. Has an effect only if O(state=present). - Needs C(zypper) version >= 1.6.2.
- Needs zypper version >= 1.6.2.
type: bool type: bool
default: false default: false
autorefresh: autorefresh:
@ -56,31 +55,29 @@ options:
- Enable autorefresh of the repository. - Enable autorefresh of the repository.
type: bool type: bool
default: true default: true
aliases: [ "refresh" ] aliases: ["refresh"]
priority: priority:
description: description:
- Set priority of repository. Packages will always be installed - Set priority of repository. Packages will always be installed from the repository with the smallest priority number.
from the repository with the smallest priority number. - Needs C(zypper) version >= 1.12.25.
- Needs zypper version >= 1.12.25.
type: int type: int
overwrite_multiple: overwrite_multiple:
description: description:
- Overwrite multiple repository entries, if repositories with both name and - Overwrite multiple repository entries, if repositories with both name and URL already exist.
URL already exist.
type: bool type: bool
default: false default: false
auto_import_keys: auto_import_keys:
description: description:
- Automatically import the gpg signing key of the new or changed repository. - Automatically import the gpg signing key of the new or changed repository.
- Has an effect only if O(state=present). Has no effect on existing (unchanged) repositories or in combination with O(state=absent). - Has an effect only if O(state=present). Has no effect on existing (unchanged) repositories or in combination with O(state=absent).
- Implies runrefresh. - Implies O(runrefresh).
- Only works with C(.repo) files if `name` is given explicitly. - Only works with C(.repo) files if O(name) is given explicitly.
type: bool type: bool
default: false default: false
runrefresh: runrefresh:
description: description:
- Refresh the package list of the given repository. - Refresh the package list of the given repository.
- Can be used with repo=* to refresh all repositories. - Can be used with O(repo=*) to refresh all repositories.
type: bool type: bool
default: false default: false
enabled: enabled:
@ -93,9 +90,9 @@ options:
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,8 +10,7 @@
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
@ -27,15 +26,15 @@ requirements:
- 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).
@ -46,36 +45,32 @@ repodatalist:
alias: alias:
description: The alias of the repository. description: The alias of the repository.
type: str type: str
sample: "SLE-Product-SLES"
autorefresh: autorefresh:
description: Indicates, if autorefresh is enabled on the repository. description: Indicates, if autorefresh is enabled on the repository.
type: int type: int
sample: "1"
enabled: enabled:
description: indicates, if the repository is enabled description: Indicates, if the repository is enabled.
type: int type: int
sample: "1"
gpgcheck: gpgcheck:
description: indicates, if the GPG signature of the repository meta data is checked description: Indicates, if the GPG signature of the repository meta data is checked.
type: int type: int
sample: "1"
name: name:
description: the name of the repository description: The name of the repository.
type: str type: str
sample: "SLE-Product-SLES"
priority: priority:
description: the priority of the repository description: The priority of the repository.
type: int type: int
sample: "99"
url: url:
description: The URL of the repository on the internet. description: The URL of the repository on the internet.
type: str type: str
sample: [ sample: "http://repo:50000/repo/SUSE/Products/SLE-Product-SLES/15-SP2/x86_64/product"
{ """
"alias": "SLE-Product-SLES",
"autorefresh": "1",
"enabled": "1",
"gpgcheck": "1",
"name": "SLE-Product-SLES",
"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