1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

apk: Add no-cache option (#548)

* apk: add no_cache option

* Fix indentation
This commit is contained in:
Amin Vakil 2020-06-23 16:40:05 +04:30 committed by GitHub
parent 4c42d0971f
commit 7e17b55884
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 0 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- apk - added ``no_cache`` option (https://github.com/ansible-collections/community.general/pull/548).

View file

@ -30,6 +30,12 @@ options:
- A package name, like C(foo), or multiple packages, like C(foo, bar). - A package name, like C(foo), or multiple packages, like C(foo, bar).
type: list type: list
elements: str elements: str
no_cache:
description:
- Do not use any local cache path.
type: bool
default: 'no'
version_added: 1.0.0
repository: repository:
description: description:
- A package repository or multiple repositories. - A package repository or multiple repositories.
@ -119,6 +125,12 @@ EXAMPLES = '''
state: latest state: latest
update_cache: yes update_cache: yes
repository: http://dl-3.alpinelinux.org/alpine/edge/main repository: http://dl-3.alpinelinux.org/alpine/edge/main
- name: Install package without using cache
apk:
name: foo
state: latest
no_cache: yes
''' '''
RETURN = ''' RETURN = '''
@ -293,6 +305,7 @@ def main():
argument_spec=dict( argument_spec=dict(
state=dict(default='present', choices=['present', 'installed', 'absent', 'removed', 'latest']), state=dict(default='present', choices=['present', 'installed', 'absent', 'removed', 'latest']),
name=dict(type='list', elements='str'), name=dict(type='list', elements='str'),
no_cache=dict(default=False, type='bool'),
repository=dict(type='list'), repository=dict(type='list'),
update_cache=dict(default=False, type='bool'), update_cache=dict(default=False, type='bool'),
upgrade=dict(default=False, type='bool'), upgrade=dict(default=False, type='bool'),
@ -311,6 +324,9 @@ def main():
p = module.params p = module.params
if p['no_cache']:
APK_PATH = "%s --no-cache" % (APK_PATH, )
# add repositories to the APK_PATH # add repositories to the APK_PATH
if p['repository']: if p['repository']:
for r in p['repository']: for r in p['repository']: