mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
* Fixes #143, change package parameter from str to list * remove uneccessary splitting * add changelog fragment * fix parameter-list-no-elements validation * fix documentation * Fix changelog * Fix documetation, add example with list of packages * Update changelogs/fragments/apt_rpm_typefix.yml Co-authored-by: Alexander Leshkov <lam@arenadata.io> Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
54014529bd
commit
16ce942448
2 changed files with 16 additions and 4 deletions
2
changelogs/fragments/apt_rpm_typefix.yml
Normal file
2
changelogs/fragments/apt_rpm_typefix.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- apt_rpm - fix ``package`` type from ``str`` to ``list`` to fix invoking with list of packages (https://github.com/ansible-collections/community.general/issues/143).
|
|
@ -17,10 +17,13 @@ short_description: apt_rpm package manager
|
|||
description:
|
||||
- Manages packages with I(apt-rpm). Both low-level (I(rpm)) and high-level (I(apt-get)) package manager binaries required.
|
||||
options:
|
||||
pkg:
|
||||
package:
|
||||
description:
|
||||
- name of package to install, upgrade or remove.
|
||||
- list of packages to install, upgrade or remove.
|
||||
required: true
|
||||
aliases: [ name, pkg ]
|
||||
type: list
|
||||
elements: str
|
||||
state:
|
||||
description:
|
||||
- Indicates the desired package state.
|
||||
|
@ -41,6 +44,13 @@ EXAMPLES = '''
|
|||
pkg: foo
|
||||
state: present
|
||||
|
||||
- name: Install packages foo and bar
|
||||
apt_rpm:
|
||||
pkg:
|
||||
- foo
|
||||
- bar
|
||||
state: present
|
||||
|
||||
- name: Remove package foo
|
||||
apt_rpm:
|
||||
pkg: foo
|
||||
|
@ -146,7 +156,7 @@ def main():
|
|||
argument_spec=dict(
|
||||
state=dict(type='str', default='installed', choices=['absent', 'installed', 'present', 'removed']),
|
||||
update_cache=dict(type='bool', default=False, aliases=['update-cache']),
|
||||
package=dict(type='str', required=True, aliases=['name', 'pkg']),
|
||||
package=dict(type='list', elements='str', required=True, aliases=['name', 'pkg']),
|
||||
),
|
||||
)
|
||||
|
||||
|
@ -158,7 +168,7 @@ def main():
|
|||
if p['update_cache']:
|
||||
update_package_db(module)
|
||||
|
||||
packages = p['package'].split(',')
|
||||
packages = p['package']
|
||||
|
||||
if p['state'] in ['installed', 'present']:
|
||||
install_packages(module, packages)
|
||||
|
|
Loading…
Reference in a new issue