From 7e17b55884d053dc96c1fae6c8cc5525ce071e79 Mon Sep 17 00:00:00 2001 From: Amin Vakil Date: Tue, 23 Jun 2020 16:40:05 +0430 Subject: [PATCH] apk: Add no-cache option (#548) * apk: add no_cache option * Fix indentation --- changelogs/fragments/548_apk.yml | 2 ++ plugins/modules/packaging/os/apk.py | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 changelogs/fragments/548_apk.yml diff --git a/changelogs/fragments/548_apk.yml b/changelogs/fragments/548_apk.yml new file mode 100644 index 0000000000..825dc830c4 --- /dev/null +++ b/changelogs/fragments/548_apk.yml @@ -0,0 +1,2 @@ +minor_changes: +- apk - added ``no_cache`` option (https://github.com/ansible-collections/community.general/pull/548). diff --git a/plugins/modules/packaging/os/apk.py b/plugins/modules/packaging/os/apk.py index b82bf6f343..2844892246 100644 --- a/plugins/modules/packaging/os/apk.py +++ b/plugins/modules/packaging/os/apk.py @@ -30,6 +30,12 @@ options: - A package name, like C(foo), or multiple packages, like C(foo, bar). type: list elements: str + no_cache: + description: + - Do not use any local cache path. + type: bool + default: 'no' + version_added: 1.0.0 repository: description: - A package repository or multiple repositories. @@ -119,6 +125,12 @@ EXAMPLES = ''' state: latest update_cache: yes repository: http://dl-3.alpinelinux.org/alpine/edge/main + +- name: Install package without using cache + apk: + name: foo + state: latest + no_cache: yes ''' RETURN = ''' @@ -293,6 +305,7 @@ def main(): argument_spec=dict( state=dict(default='present', choices=['present', 'installed', 'absent', 'removed', 'latest']), name=dict(type='list', elements='str'), + no_cache=dict(default=False, type='bool'), repository=dict(type='list'), update_cache=dict(default=False, type='bool'), upgrade=dict(default=False, type='bool'), @@ -311,6 +324,9 @@ def main(): p = module.params + if p['no_cache']: + APK_PATH = "%s --no-cache" % (APK_PATH, ) + # add repositories to the APK_PATH if p['repository']: for r in p['repository']: