mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-09 04:00:31 -07: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:
|
description:
|
||||||
- Manages packages with I(apt-rpm). Both low-level (I(rpm)) and high-level (I(apt-get)) package manager binaries required.
|
- Manages packages with I(apt-rpm). Both low-level (I(rpm)) and high-level (I(apt-get)) package manager binaries required.
|
||||||
options:
|
options:
|
||||||
pkg:
|
package:
|
||||||
description:
|
description:
|
||||||
- name of package to install, upgrade or remove.
|
- list of packages to install, upgrade or remove.
|
||||||
required: true
|
required: true
|
||||||
|
aliases: [ name, pkg ]
|
||||||
|
type: list
|
||||||
|
elements: str
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- Indicates the desired package state.
|
- Indicates the desired package state.
|
||||||
|
@ -41,6 +44,13 @@ EXAMPLES = '''
|
||||||
pkg: foo
|
pkg: foo
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
|
- name: Install packages foo and bar
|
||||||
|
apt_rpm:
|
||||||
|
pkg:
|
||||||
|
- foo
|
||||||
|
- bar
|
||||||
|
state: present
|
||||||
|
|
||||||
- name: Remove package foo
|
- name: Remove package foo
|
||||||
apt_rpm:
|
apt_rpm:
|
||||||
pkg: foo
|
pkg: foo
|
||||||
|
@ -146,7 +156,7 @@ def main():
|
||||||
argument_spec=dict(
|
argument_spec=dict(
|
||||||
state=dict(type='str', default='installed', choices=['absent', 'installed', 'present', 'removed']),
|
state=dict(type='str', default='installed', choices=['absent', 'installed', 'present', 'removed']),
|
||||||
update_cache=dict(type='bool', default=False, aliases=['update-cache']),
|
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']:
|
if p['update_cache']:
|
||||||
update_package_db(module)
|
update_package_db(module)
|
||||||
|
|
||||||
packages = p['package'].split(',')
|
packages = p['package']
|
||||||
|
|
||||||
if p['state'] in ['installed', 'present']:
|
if p['state'] in ['installed', 'present']:
|
||||||
install_packages(module, packages)
|
install_packages(module, packages)
|
||||||
|
|
Loading…
Add table
Reference in a new issue